|
| 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