@@ -95,7 +95,7 @@ public void testUploadScreenshot(String fileName, String sourceFilePath, Long so
95
95
when (projectFull .getDirectories ()).thenReturn (nonNull (directoryId ) ? directories : new HashMap <>());
96
96
97
97
when (projectClient .uploadStorage (eq (fileName ), any ())).thenReturn (1L );
98
- when (client .listScreenshots ( null )).thenReturn (new ArrayList <>());
98
+ when (client .listScreenshotsByName ( eq ( fileName ) )).thenReturn (new ArrayList <>());
99
99
100
100
when (client .uploadScreenshot (request ))
101
101
.thenReturn (new Screenshot () {{
@@ -106,7 +106,7 @@ public void testUploadScreenshot(String fileName, String sourceFilePath, Long so
106
106
action = new ScreenshotUploadAction (fileToUpload , branchName , labelNames , sourceFilePath , directoryPath , autoTag , false , false , projectClient );
107
107
action .act (Outputter .getDefault (), pb , client );
108
108
109
- verify (client ).listScreenshots ( null );
109
+ verify (client ).listScreenshotsByName ( eq ( fileName ) );
110
110
verify (client ).uploadScreenshot (request );
111
111
verifyNoMoreInteractions (client );
112
112
}
@@ -134,11 +134,12 @@ public void testUploadScreenshotToUpdate() throws ResponseException {
134
134
135
135
when (screenshot .getName ()).thenReturn (fileName );
136
136
when (screenshot .getId ()).thenReturn (123L );
137
- when (client .listScreenshots ( null )).thenReturn (Arrays .asList (screenshot ));
137
+ when (client .listScreenshotsByName ( eq ( fileName ) )).thenReturn (Arrays .asList (screenshot ));
138
138
139
139
UpdateScreenshotRequest request = new UpdateScreenshotRequest ();
140
140
request .setStorageId (1L );
141
141
request .setName (fileName );
142
+ request .setUsePreviousTags (true );
142
143
143
144
ProjectClient projectClient = mock (ProjectClient .class );
144
145
when (projectClient .uploadStorage (eq (fileName ), any ())).thenReturn (1L );
@@ -152,7 +153,7 @@ public void testUploadScreenshotToUpdate() throws ResponseException {
152
153
action = new ScreenshotUploadAction (fileToUpload , null , null , null , null , false , false , false , projectClient );
153
154
action .act (Outputter .getDefault (), pb , client );
154
155
155
- verify (client ).listScreenshots ( null );
156
+ verify (client ).listScreenshotsByName ( eq ( fileName ) );
156
157
verify (client ).updateScreenshot (123L , request );
157
158
verifyNoMoreInteractions (client );
158
159
}
@@ -165,7 +166,7 @@ public void testUploadScreenshotNotExistingBranch() {
165
166
PropertiesWithFiles pb = pbBuilder .build ();
166
167
167
168
ClientScreenshot client = mock (ClientScreenshot .class );
168
- when (client .listScreenshots ( null )).thenReturn (new ArrayList <>());
169
+ when (client .listScreenshotsByName ( eq ( "screenshot.png" ) )).thenReturn (new ArrayList <>());
169
170
170
171
ProjectClient projectClient = mock (ProjectClient .class );
171
172
CrowdinProjectFull projectFull = mock (CrowdinProjectFull .class );
@@ -185,7 +186,7 @@ public void testUploadScreenshotNotExistingSourceFile() {
185
186
PropertiesWithFiles pb = pbBuilder .build ();
186
187
187
188
ClientScreenshot client = mock (ClientScreenshot .class );
188
- when (client .listScreenshots ( null )).thenReturn (new ArrayList <>());
189
+ when (client .listScreenshotsByName ( "screenshot.png" )).thenReturn (new ArrayList <>());
189
190
190
191
ProjectClient projectClient = mock (ProjectClient .class );
191
192
CrowdinProjectFull projectFull = mock (CrowdinProjectFull .class );
@@ -205,7 +206,7 @@ public void testUploadScreenshotNotExistingDirectory() {
205
206
PropertiesWithFiles pb = pbBuilder .build ();
206
207
207
208
ClientScreenshot client = mock (ClientScreenshot .class );
208
- when (client .listScreenshots ( null )).thenReturn (new ArrayList <>());
209
+ when (client .listScreenshotsByName ( "screenshot.png" )).thenReturn (new ArrayList <>());
209
210
210
211
ProjectClient projectClient = mock (ProjectClient .class );
211
212
CrowdinProjectFull projectFull = mock (CrowdinProjectFull .class );
@@ -251,7 +252,7 @@ public void testUploadScreenshotWithLabels() throws ResponseException {
251
252
252
253
when (projectClient .uploadStorage (eq ("screenshot.png" ), any ())).thenReturn (1L );
253
254
when (projectClient .listLabels ()).thenReturn (Arrays .asList (label1 , label2 ));
254
- when (client .listScreenshots ( null )).thenReturn (new ArrayList <>());
255
+ when (client .listScreenshotsByName ( eq ( fileToUpload . getName ()) )).thenReturn (new ArrayList <>());
255
256
256
257
when (client .uploadScreenshot (request ))
257
258
.thenReturn (new Screenshot () {{
@@ -262,7 +263,7 @@ public void testUploadScreenshotWithLabels() throws ResponseException {
262
263
action = new ScreenshotUploadAction (fileToUpload , null , Arrays .asList ("label1" , "label2" ), null , null , false , false , false , projectClient );
263
264
action .act (Outputter .getDefault (), pb , client );
264
265
265
- verify (client ).listScreenshots ( null );
266
+ verify (client ).listScreenshotsByName ( eq ( fileToUpload . getName ()) );
266
267
verify (client ).uploadScreenshot (request );
267
268
verify (projectClient ).downloadFullProject ();
268
269
verify (projectClient ).listLabels ();
@@ -303,7 +304,7 @@ public void testUploadScreenshotNotExistingLabel() throws ResponseException {
303
304
when (projectClient .uploadStorage (eq ("screenshot.png" ), any ())).thenReturn (1L );
304
305
when (projectClient .listLabels ()).thenReturn (new ArrayList <>());
305
306
when (projectClient .addLabel (any ())).thenReturn (label1 );
306
- when (client .listScreenshots ( null )).thenReturn (new ArrayList <>());
307
+ when (client .listScreenshotsByName ( eq ( fileToUpload . getName ()) )).thenReturn (new ArrayList <>());
307
308
308
309
when (client .uploadScreenshot (request ))
309
310
.thenReturn (new Screenshot () {{
@@ -314,7 +315,7 @@ public void testUploadScreenshotNotExistingLabel() throws ResponseException {
314
315
action = new ScreenshotUploadAction (fileToUpload , null , Arrays .asList ("label1" ), null , null , false , false , false , projectClient );
315
316
action .act (Outputter .getDefault (), pb , client );
316
317
317
- verify (client ).listScreenshots ( null );
318
+ verify (client ).listScreenshotsByName ( eq ( fileToUpload . getName ()) );
318
319
verify (client ).uploadScreenshot (request );
319
320
verify (projectClient ).downloadFullProject ();
320
321
verify (projectClient ).listLabels ();
0 commit comments