use of com.testvagrant.ekam.dataclients.ListDataClient in project ekam by testvagrant.
the class DataSetsNegativeTests method shouldThrowException.
@Test
@ClearSystemProperty(key = "datasets.env")
@SetSystemProperty(key = "datasets.dir", value = "blahblahblah")
public void shouldThrowException() {
ListDataClient dataClient = new ListDataClient();
Exception exception = assertThrows(RuntimeException.class, () -> dataClient.getList("package_managers"));
String exceptionMessage = exception.getMessage();
Assertions.assertTrue(exceptionMessage.contains("'package_managers' key not found in data_sets") && exceptionMessage.contains(String.format("Files searched under directory: '%s/%s'", ResourcePaths.TEST_RESOURCES, "blahblahblah")));
}
use of com.testvagrant.ekam.dataclients.ListDataClient in project ekam by testvagrant.
the class DataSetsNegativeTests method shouldThrowExceptionWhenFileNotPresentForAnEnv.
@Test
@SetSystemProperty(key = "datasets.dir", value = "data_sets")
@SetSystemProperty(key = "datasets.env", value = "staging")
public void shouldThrowExceptionWhenFileNotPresentForAnEnv() {
ListDataClient dataClient = new ListDataClient();
Exception exception = assertThrows(RuntimeException.class, () -> dataClient.getList("package_managers"), ".*'package_managers' key not found in data_sets for Env: 'staging'.*");
String exceptionMessage = exception.getMessage();
String keyNotFoundInEnv = "'package_managers' key not found in data_sets for Env: 'staging'";
String searchDirectory = String.format("Files searched under directory: '%s/%s'", ResourcePaths.TEST_RESOURCES, System.getProperty("datasets.dir"));
Assertions.assertTrue(exceptionMessage.contains(keyNotFoundInEnv) && exceptionMessage.contains(searchDirectory));
}
Aggregations