Skip to content

Commit 0aae559

Browse files
committed
Adjust test
1 parent 6894de5 commit 0aae559

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/test/java/io/simplelocalize/cli/command/UploadCommandTest.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import io.simplelocalize.cli.client.SimpleLocalizeClient;
44
import io.simplelocalize.cli.client.dto.UploadRequest;
55
import io.simplelocalize.cli.configuration.Configuration;
6-
import org.assertj.core.api.Assertions;
76
import org.junit.jupiter.api.AfterEach;
87
import org.junit.jupiter.api.BeforeEach;
98
import org.junit.jupiter.api.Test;
@@ -15,6 +14,9 @@
1514
import java.nio.file.Path;
1615
import java.util.Collections;
1716

17+
import static org.mockito.ArgumentMatchers.any;
18+
import static org.mockito.Mockito.times;
19+
1820
@ExtendWith(MockitoExtension.class)
1921
class UploadCommandTest
2022
{
@@ -51,7 +53,7 @@ public void shouldUploadTwelveFiles() throws Exception
5153
uploadCommand.invoke();
5254

5355
//then
54-
Mockito.verify(client, Mockito.times(12)).uploadFile(
56+
Mockito.verify(client, times(12)).uploadFile(
5557
Mockito.refEq(UploadRequest.UploadFileRequestBuilder.anUploadFileRequest()
5658
.withPath(Path.of("./junit/download-test/values-{lang}/strings.xml"))
5759
.withFormat("android")
@@ -77,7 +79,7 @@ public void shouldUploadOneFileWithLangTemplate() throws Exception
7779
uploadCommand.invoke();
7880

7981
//then
80-
Mockito.verify(client, Mockito.times(1)).uploadFile(
82+
Mockito.verify(client, times(1)).uploadFile(
8183
Mockito.refEq(UploadRequest.UploadFileRequestBuilder.anUploadFileRequest()
8284
.withPath(Path.of("./junit/download-test/values-{lang}/strings.xml"))
8385
.withFormat("android")
@@ -103,7 +105,7 @@ public void shouldUploadOneFileWithOnlyTranslationKeys() throws Exception
103105
uploadCommand.invoke();
104106

105107
//then
106-
Mockito.verify(client, Mockito.times(1)).uploadFile(
108+
Mockito.verify(client, times(1)).uploadFile(
107109
Mockito.refEq(UploadRequest.UploadFileRequestBuilder.anUploadFileRequest()
108110
.withPath(Path.of("./junit/download-test/values-en/strings.xml"))
109111
.withFormat("android")
@@ -146,7 +148,7 @@ public void shouldUploadOneFile() throws Exception
146148
uploadCommand.invoke();
147149

148150
//then
149-
Mockito.verify(client, Mockito.times(1)).uploadFile(
151+
Mockito.verify(client, times(1)).uploadFile(
150152
Mockito.refEq(UploadRequest.UploadFileRequestBuilder.anUploadFileRequest()
151153
.withPath(Path.of("./junit/download-test/values-{lang}/strings.xml"))
152154
.withFormat("android")
@@ -177,7 +179,7 @@ public void shouldUploadZeroFiles() throws Exception
177179

178180

179181
@Test
180-
public void shouldThrowMatchingFilesCouldNotBeFoundWhenFakeWindows() throws Exception
182+
public void shouldNotFindMatchingFilesWhenFakeWindows() throws Exception
181183
{
182184
//given
183185
System.setProperty("os.name", "Windows 10");
@@ -186,10 +188,11 @@ public void shouldThrowMatchingFilesCouldNotBeFoundWhenFakeWindows() throws Exce
186188
configuration.setUploadPath("./junit/download-test/values-en/strings.xml");
187189
configuration.setUploadFormat("android");
188190

189-
//when & then
191+
//when
190192
UploadCommand uploadCommand = new UploadCommand(client, configuration);
191-
Assertions
192-
.assertThatThrownBy(uploadCommand::invoke)
193-
.isInstanceOf(IllegalArgumentException.class);
193+
uploadCommand.invoke();
194+
195+
//then
196+
Mockito.verify(client, times(0)).uploadFile(any());
194197
}
195198
}

0 commit comments

Comments
 (0)