Skip to content

Commit 80f84b9

Browse files
authored
Merge pull request bcgov#154 from sdevalapurkar/sd-access-auto-tests
Add AccessAutoConfiguration tests
2 parents f45d9a5 + f30cc9c commit 80f84b9

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package ca.bc.gov.open.jrccaccess.autoconfigure;
2+
3+
import org.junit.BeforeClass;
4+
import org.junit.Test;
5+
6+
import ca.bc.gov.open.jrccaccess.autoconfigure.common.Constants;
7+
import ca.bc.gov.open.jrccaccess.autoconfigure.AccessProperties;
8+
import ca.bc.gov.open.jrccaccess.autoconfigure.AccessProperties.PluginConfig;
9+
10+
import static org.junit.Assert.assertEquals;
11+
12+
public class AccessPropertiesTests {
13+
14+
@Test
15+
public void with_sender_should_set_sender() {
16+
String sender = "bcgov";
17+
18+
AccessProperties properties = new AccessProperties();
19+
properties.setInput(new AccessProperties.PluginConfig());
20+
PluginConfig pluginConfig = properties.getInput();
21+
22+
pluginConfig.setSender(sender);
23+
24+
assertEquals(pluginConfig.getSender(), sender);
25+
}
26+
27+
@Test
28+
public void with_no_explicit_sender_should_return_default() {
29+
AccessProperties properties = new AccessProperties();
30+
properties.setInput(new AccessProperties.PluginConfig());
31+
PluginConfig pluginConfig = properties.getInput();
32+
33+
assertEquals(pluginConfig.getSender(), Constants.UNKNOWN_SENDER);
34+
}
35+
36+
@Test
37+
public void with_plugin_should_set_plugin() {
38+
String plugin = "sftp";
39+
40+
AccessProperties properties = new AccessProperties();
41+
properties.setInput(new AccessProperties.PluginConfig());
42+
PluginConfig pluginConfig = properties.getInput();
43+
44+
pluginConfig.setPlugin(plugin);
45+
46+
assertEquals(pluginConfig.getPlugin(), plugin);
47+
}
48+
49+
}

0 commit comments

Comments
 (0)