Commit f0084040 authored by jashaikh's avatar jashaikh

Added Jacoco Code Coverage For Sonar.

parent f42a7cb8
......@@ -47,6 +47,8 @@ public class AzureAppConfigService {
public String writeValueByKey(String key, String value) {
try {
LOGGER.info("Writing Single Value by key");
if(key == null || value == null)
throw new Exception("Key and Value cannot be null");
ConfigurationSetting configurationSetting = configurationClient.setConfigurationSetting(key, null, value);
return configurationSetting.getValue();
} catch (Exception e) {
......@@ -61,12 +63,7 @@ public class AzureAppConfigService {
*/
public PagedIterable<ConfigurationSetting> readAllKeyValue() {
LOGGER.info("Read All Values...");
try {
return configurationClient.listConfigurationSettings(settingSelector);
} catch (Exception e) {
LOGGER.error(e.getMessage());
return null;
}
}
/**
......
......@@ -11,8 +11,7 @@ import org.junit.jupiter.api.TestMethodOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(OrderAnnotation.class)
class AzureAppConfigServiceTest {
......@@ -40,6 +39,12 @@ class AzureAppConfigServiceTest {
assertEquals(EXISTING_VALUE, valueByKey);
}
@Test
@Order(5)
void getValueByKeyException() {
assertNull(azureAppConfigService.getValueByKey(null));
}
@Test
@Order(2)
void writeValueByKey() {
......@@ -49,6 +54,12 @@ class AzureAppConfigServiceTest {
assertEquals(NEW_VALUE, writeValueByKey);
}
@Test
@Order(6)
void writeValueByKeyException() {
assertNull(azureAppConfigService.writeValueByKey(null, null));
}
@Test
@Order(4)
void readAllKeyValue() {
......@@ -64,4 +75,10 @@ class AzureAppConfigServiceTest {
assertNotNull(valueByKey);
assertEquals(NEW_VALUE, valueByKey);
}
@Test
@Order(7)
void deleteValueByKeyException() {
assertNull(azureAppConfigService.deleteValueByKey(null));
}
}
\ 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