55import org .junit .jupiter .api .BeforeEach ;
66import org .junit .jupiter .api .Test ;
77import org .mockito .Mock ;
8- import org .mockito .Mockito ;
98import org .mockito .MockitoAnnotations ;
109
1110import static org .junit .jupiter .api .Assertions .assertEquals ;
11+ import static org .mockito .Mockito .verify ;
12+ import static org .mockito .Mockito .when ;
1213
1314class UploadDurationMetricsTest {
1415
@@ -30,137 +31,137 @@ class UploadDurationMetricsTest {
3031 void setUp () throws Exception {
3132 MockitoAnnotations .openMocks (this )
3233 .close ();
33- Mockito . when (uploadDurationTracker .getAppBinaryStatistics ())
34- .thenReturn (appBinaryStatistics );
35- Mockito . when (uploadDurationTracker .getObjectStoreStatistics ())
36- .thenReturn (objectStoreStatistics );
34+ when (uploadDurationTracker .getAppBinaryStatistics ())
35+ .thenReturn (appBinaryStatistics );
36+ when (uploadDurationTracker .getObjectStoreStatistics ())
37+ .thenReturn (objectStoreStatistics );
3738 uploadDurationMetrics = new UploadDurationMetrics (uploadDurationTracker , appUploaderInfo );
3839 }
3940
4041 @ Test
4142 void testGetAppBinaryUploadTotalCount () {
42- Mockito . when (appBinaryStatistics .totalCount ())
43- .thenReturn (11L );
43+ when (appBinaryStatistics .totalCount ())
44+ .thenReturn (11L );
4445 assertEquals (11L , uploadDurationMetrics .getAppBinaryUploadTotalCount ());
45- Mockito . verify (appBinaryStatistics )
46- .totalCount ();
46+ verify (appBinaryStatistics )
47+ .totalCount ();
4748 }
4849
4950 @ Test
5051 void testGetAppBinaryUploadTimeoutCount () {
51- Mockito . when (appBinaryStatistics .timeoutCount ())
52- .thenReturn (12L );
52+ when (appBinaryStatistics .timeoutCount ())
53+ .thenReturn (12L );
5354 assertEquals (12L , uploadDurationMetrics .getAppBinaryUploadTimeoutCount ());
54- Mockito . verify (appBinaryStatistics )
55- .timeoutCount ();
55+ verify (appBinaryStatistics )
56+ .timeoutCount ();
5657 }
5758
5859 @ Test
5960 void testGetAppBinaryUploadMaxDurationMs () {
60- Mockito . when (appBinaryStatistics .maxDurationMs ())
61- .thenReturn (13L );
61+ when (appBinaryStatistics .maxDurationMs ())
62+ .thenReturn (13L );
6263 assertEquals (13L , uploadDurationMetrics .getAppBinaryUploadMaxDurationMs ());
63- Mockito . verify (appBinaryStatistics )
64- .maxDurationMs ();
64+ verify (appBinaryStatistics )
65+ .maxDurationMs ();
6566 }
6667
6768 @ Test
6869 void testGetAppBinaryUploadSumDurationMs () {
69- Mockito . when (appBinaryStatistics .sumDurationMs ())
70- .thenReturn (14L );
70+ when (appBinaryStatistics .sumDurationMs ())
71+ .thenReturn (14L );
7172 assertEquals (14L , uploadDurationMetrics .getAppBinaryUploadSumDurationMs ());
72- Mockito . verify (appBinaryStatistics )
73- .sumDurationMs ();
73+ verify (appBinaryStatistics )
74+ .sumDurationMs ();
7475 }
7576
7677 @ Test
7778 void testGetAppUploaderActiveThreads () {
78- Mockito . when (appUploaderInfo .getActiveThreads ())
79- .thenReturn (3 );
79+ when (appUploaderInfo .getActiveThreads ())
80+ .thenReturn (3 );
8081 assertEquals (3 , uploadDurationMetrics .getAppUploaderActiveThreads ());
81- Mockito . verify (appUploaderInfo )
82- .getActiveThreads ();
82+ verify (appUploaderInfo )
83+ .getActiveThreads ();
8384 }
8485
8586 @ Test
8687 void testGetAppUploaderMaxThreads () {
87- Mockito . when (appUploaderInfo .getMaxThreads ())
88- .thenReturn (7 );
88+ when (appUploaderInfo .getMaxThreads ())
89+ .thenReturn (7 );
8990 assertEquals (7 , uploadDurationMetrics .getAppUploaderMaxThreads ());
90- Mockito . verify (appUploaderInfo )
91- .getMaxThreads ();
91+ verify (appUploaderInfo )
92+ .getMaxThreads ();
9293 }
9394
9495 @ Test
9596 void testGetAppUploaderRejectionCount () {
96- Mockito . when (appBinaryStatistics .rejectionCount ())
97- .thenReturn (15L );
97+ when (appBinaryStatistics .rejectionCount ())
98+ .thenReturn (15L );
9899 assertEquals (15L , uploadDurationMetrics .getAppUploaderRejectionCount ());
99- Mockito . verify (appBinaryStatistics )
100- .rejectionCount ();
100+ verify (appBinaryStatistics )
101+ .rejectionCount ();
101102 }
102103
103104 @ Test
104105 void testGetAppUploaderRejectionCountInWindow () {
105- Mockito . when (appBinaryStatistics .rejectionsInWindow ())
106- .thenReturn (16L );
106+ when (appBinaryStatistics .rejectionsInWindow ())
107+ .thenReturn (16L );
107108 assertEquals (16L , uploadDurationMetrics .getAppUploaderRejectionCountInWindow ());
108- Mockito . verify (appBinaryStatistics )
109- .rejectionsInWindow ();
109+ verify (appBinaryStatistics )
110+ .rejectionsInWindow ();
110111 }
111112
112113 @ Test
113114 void testGetObjectStoreUploadTotalCount () {
114- Mockito . when (objectStoreStatistics .totalCount ())
115- .thenReturn (21L );
115+ when (objectStoreStatistics .totalCount ())
116+ .thenReturn (21L );
116117 assertEquals (21L , uploadDurationMetrics .getObjectStoreUploadTotalCount ());
117- Mockito . verify (objectStoreStatistics )
118- .totalCount ();
118+ verify (objectStoreStatistics )
119+ .totalCount ();
119120 }
120121
121122 @ Test
122123 void testGetObjectStoreUploadTimeoutCount () {
123- Mockito . when (objectStoreStatistics .timeoutCount ())
124- .thenReturn (22L );
124+ when (objectStoreStatistics .timeoutCount ())
125+ .thenReturn (22L );
125126 assertEquals (22L , uploadDurationMetrics .getObjectStoreUploadTimeoutCount ());
126- Mockito . verify (objectStoreStatistics )
127- .timeoutCount ();
127+ verify (objectStoreStatistics )
128+ .timeoutCount ();
128129 }
129130
130131 @ Test
131132 void testGetObjectStoreUploadMaxDurationMs () {
132- Mockito . when (objectStoreStatistics .maxDurationMs ())
133- .thenReturn (23L );
133+ when (objectStoreStatistics .maxDurationMs ())
134+ .thenReturn (23L );
134135 assertEquals (23L , uploadDurationMetrics .getObjectStoreUploadMaxDurationMs ());
135- Mockito . verify (objectStoreStatistics )
136- .maxDurationMs ();
136+ verify (objectStoreStatistics )
137+ .maxDurationMs ();
137138 }
138139
139140 @ Test
140141 void testGetObjectStoreUploadSumDurationMs () {
141- Mockito . when (objectStoreStatistics .sumDurationMs ())
142- .thenReturn (24L );
142+ when (objectStoreStatistics .sumDurationMs ())
143+ .thenReturn (24L );
143144 assertEquals (24L , uploadDurationMetrics .getObjectStoreUploadSumDurationMs ());
144- Mockito . verify (objectStoreStatistics )
145- .sumDurationMs ();
145+ verify (objectStoreStatistics )
146+ .sumDurationMs ();
146147 }
147148
148149 @ Test
149150 void testGetAppBinaryUploadTimeoutsInWindow () {
150- Mockito . when (appBinaryStatistics .timeoutsInWindow ())
151- .thenReturn (17L );
151+ when (appBinaryStatistics .timeoutsInWindow ())
152+ .thenReturn (17L );
152153 assertEquals (17L , uploadDurationMetrics .getAppBinaryUploadTimeoutsInWindow ());
153- Mockito . verify (appBinaryStatistics )
154- .timeoutsInWindow ();
154+ verify (appBinaryStatistics )
155+ .timeoutsInWindow ();
155156 }
156157
157158 @ Test
158159 void testGetObjectStoreUploadTimeoutsInWindow () {
159- Mockito . when (objectStoreStatistics .timeoutsInWindow ())
160- .thenReturn (25L );
160+ when (objectStoreStatistics .timeoutsInWindow ())
161+ .thenReturn (25L );
161162 assertEquals (25L , uploadDurationMetrics .getObjectStoreUploadTimeoutsInWindow ());
162- Mockito . verify (objectStoreStatistics )
163- .timeoutsInWindow ();
163+ verify (objectStoreStatistics )
164+ .timeoutsInWindow ();
164165 }
165166
166167}
0 commit comments