Skip to content

Commit 9bbf929

Browse files
committed
Increase test coverage
1 parent cee3624 commit 9bbf929

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

junit/empty-test/strings.xml

Whitespace-only changes.

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,48 @@ public void shouldUploadOneFileWithLangTemplate() throws Exception
7272
);
7373
}
7474

75+
@Test
76+
public void shouldUploadOneFileWithOnlyTranslationKeys() 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.setUploadFormat("android");
83+
84+
//when
85+
UploadCommand uploadCommand = new UploadCommand(client, configuration);
86+
uploadCommand.invoke();
87+
88+
//then
89+
Mockito.verify(client, Mockito.times(1)).uploadFile(
90+
Mockito.refEq(UploadRequest.UploadFileRequestBuilder.anUploadFileRequest()
91+
.withPath(Path.of("./junit/download-test/values-en/strings.xml"))
92+
.withFormat("android")
93+
.withLanguageKey("")
94+
.withOptions(Collections.emptyList())
95+
.build()
96+
)
97+
);
98+
}
99+
100+
@Test
101+
public void shouldSkipEmptyFile() throws Exception
102+
{
103+
//given
104+
Configuration configuration = new Configuration();
105+
configuration.setApiKey("my-api-key");
106+
configuration.setUploadPath("./junit/empty-test/strings.xml");
107+
configuration.setUploadFormat("android");
108+
109+
//when
110+
UploadCommand uploadCommand = new UploadCommand(client, configuration);
111+
uploadCommand.invoke();
112+
113+
//then
114+
Mockito.verifyNoInteractions(client);
115+
}
116+
75117
@Test
76118
public void shouldUploadOneFile() throws Exception
77119
{

0 commit comments

Comments
 (0)