Commit cb33214c authored by Jalaluddin Shaikh's avatar Jalaluddin Shaikh

Added JUnit Test Cases.

parent 6a8de120
......@@ -14,29 +14,34 @@ import static org.junit.Assert.assertNotNull;
public class AzureAppConfigServiceTest {
private static final Logger LOGGER = LoggerFactory.getLogger(AzureAppConfigServiceTest.class);
AzureAppConfigService azureAppConfigService;
private static final String APP_CONFIGURATION_CONNECTION_STRING = "APP_CONFIGURATION_CONNECTION_STRING";
private static final String EXISTING_KEY = "config.message";
private static final String EXISTING_VALUE = "This is Azure App Config";
private static final String NEW_KEY = "config.dataSource";
private static final String NEW_VALUE = "Data Source URL";
private AzureAppConfigService azureAppConfigService;
@Before
public void setUp() {
String app_configuration_connection_string = System.getenv("APP_CONFIGURATION_CONNECTION_STRING");
String app_configuration_connection_string = System.getenv(APP_CONFIGURATION_CONNECTION_STRING);
ConfigurationClient configurationClient = new ConfigurationClientBuilder().connectionString(app_configuration_connection_string).buildClient();
azureAppConfigService = new AzureAppConfigService(configurationClient, new SettingSelector());
}
@Test
public void getValueByKey() {
String valueByKey = azureAppConfigService.getValueByKey("config.message");
String valueByKey = azureAppConfigService.getValueByKey(EXISTING_KEY);
LOGGER.info(valueByKey);
assertNotNull(valueByKey);
assertEquals("This is Azure App Config", valueByKey);
assertEquals(EXISTING_VALUE, valueByKey);
}
@Test
public void writeValueByKey() {
String writeValueByKey = azureAppConfigService.writeValueByKey("config.dataSource", "Data Source URL");
String writeValueByKey = azureAppConfigService.writeValueByKey(NEW_KEY, NEW_VALUE);
LOGGER.info(writeValueByKey);
assertNotNull(writeValueByKey);
assertEquals("Data Source URL", writeValueByKey);
assertEquals(NEW_VALUE, writeValueByKey);
}
@Test
......@@ -47,13 +52,9 @@ public class AzureAppConfigServiceTest {
@Test
public void deleteValueByKey() {
String valueByKey = azureAppConfigService.deleteValueByKey("config.dataSource");
String valueByKey = azureAppConfigService.deleteValueByKey(NEW_KEY);
LOGGER.info(valueByKey);
assertNotNull(valueByKey);
assertEquals("Data Source URL", valueByKey);
}
@Test
public void azureAppConfiguration() {
assertEquals(NEW_VALUE, valueByKey);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment