Skip to content

Commit 130c98c

Browse files
authored
Merge pull request bcgov#148 from sdevalapurkar/sd-improve-test-coverage-5
Add SftpInputProperties test cases
2 parents 1ac9747 + eaab799 commit 130c98c

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

jrcc-access-spring-boot-autoconfigure/src/test/java/ca/bc/gov/open/jrccaccess/autoconfigure/plugins/sftp/SftpInputPropertiesTests.java

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,68 @@ public void with_ssh_key_should_return_ssh_key() {
1818
Assert.assertNotNull(sut.getSshPrivateKey());
1919
}
2020

21+
@Test
22+
public void with_remote_directory_should_return_remote_directory() {
23+
SftpInputProperties sut = new SftpInputProperties();
24+
sut.setRemoteDirectory("/upload");
25+
Assert.assertEquals(sut.getRemoteDirectory(), "/upload");
26+
}
27+
28+
@Test
29+
public void with_host_should_return_host() {
30+
SftpInputProperties sut = new SftpInputProperties();
31+
sut.setHost("localhost");
32+
Assert.assertEquals(sut.getHost(), "localhost");
33+
}
34+
35+
@Test
36+
public void with_port_should_return_integer_value_of_port() {
37+
SftpInputProperties sut = new SftpInputProperties();
38+
sut.setPort("22");
39+
Assert.assertEquals(sut.getPort(), Integer.valueOf("22"));
40+
}
41+
42+
@Test
43+
public void with_username_should_return_username() {
44+
SftpInputProperties sut = new SftpInputProperties();
45+
sut.setUsername("user");
46+
Assert.assertEquals(sut.getUsername(), "user");
47+
}
48+
49+
@Test
50+
public void with_password_should_return_password() {
51+
SftpInputProperties sut = new SftpInputProperties();
52+
sut.setPassword("pass");
53+
Assert.assertEquals(sut.getPassword(), "pass");
54+
}
55+
56+
@Test
57+
public void with_cron_should_return_cron() {
58+
SftpInputProperties sut = new SftpInputProperties();
59+
sut.setCron("0/5 * * * * *");
60+
Assert.assertEquals(sut.getCron(), "0/5 * * * * *");
61+
}
62+
63+
@Test
64+
public void with_filter_pattern_should_return_filter_pattern() {
65+
SftpInputProperties sut = new SftpInputProperties();
66+
sut.setFilterPattern("filter-pattern");
67+
Assert.assertEquals(sut.getFilterPattern(), "filter-pattern");
68+
}
69+
70+
@Test
71+
public void with_max_message_per_poll_should_return_max_message_per_poll() {
72+
SftpInputProperties sut = new SftpInputProperties();
73+
sut.setMaxMessagePerPoll("5");
74+
Assert.assertEquals(sut.getMaxMessagePerPoll(), "5");
75+
}
76+
77+
@Test
78+
public void with_ssh_private_passphrase_should_return_ssh_private_passphrase() {
79+
SftpInputProperties sut = new SftpInputProperties();
80+
sut.setSshPrivatePassphrase("passphrase");
81+
Assert.assertEquals(sut.getSshPrivatePassphrase(), "passphrase");
82+
}
2183

2284
@Test
2385
public void default_allow_unknown_key_return_false() {

0 commit comments

Comments
 (0)