Skip to content

Commit cee3624

Browse files
committed
Add tests
1 parent 5d576d0 commit cee3624

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,60 @@ public void shouldUploadTwelveFiles() throws Exception
4545
);
4646
}
4747

48+
@Test
49+
public void shouldUploadOneFileWithLangTemplate() throws Exception
50+
{
51+
//given
52+
Configuration configuration = new Configuration();
53+
configuration.setApiKey("my-api-key");
54+
configuration.setUploadPath("./junit/download-test/values-{lang}/strings.xml");
55+
configuration.setLanguageKey("en");
56+
configuration.setUploadFormat("android");
57+
58+
//when
59+
UploadCommand uploadCommand = new UploadCommand(client, configuration);
60+
uploadCommand.invoke();
61+
62+
//then
63+
Mockito.verify(client, Mockito.times(1)).uploadFile(
64+
Mockito.refEq(UploadRequest.UploadFileRequestBuilder.anUploadFileRequest()
65+
.withPath(Path.of("./junit/download-test/values-{lang}/strings.xml"))
66+
.withFormat("android")
67+
.withLanguageKey("en")
68+
.withOptions(Collections.emptyList())
69+
.build(),
70+
"path"
71+
)
72+
);
73+
}
74+
75+
@Test
76+
public void shouldUploadOneFile() throws Exception
77+
{
78+
//given
79+
Configuration configuration = new Configuration();
80+
configuration.setApiKey("my-api-key");
81+
configuration.setUploadPath("./junit/download-test/values-en/strings.xml");
82+
configuration.setLanguageKey("en");
83+
configuration.setUploadFormat("android");
84+
85+
//when
86+
UploadCommand uploadCommand = new UploadCommand(client, configuration);
87+
uploadCommand.invoke();
88+
89+
//then
90+
Mockito.verify(client, Mockito.times(1)).uploadFile(
91+
Mockito.refEq(UploadRequest.UploadFileRequestBuilder.anUploadFileRequest()
92+
.withPath(Path.of("./junit/download-test/values-{lang}/strings.xml"))
93+
.withFormat("android")
94+
.withLanguageKey("en")
95+
.withOptions(Collections.emptyList())
96+
.build(),
97+
"path"
98+
)
99+
);
100+
}
101+
48102
@Test
49103
public void shouldUploadZeroFiles() throws Exception
50104
{

0 commit comments

Comments
 (0)