Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void TestPrivateMethod_GetCountryByNameEmptyCountryName() throws NoSuchMe
Test when server is down throw NullPointer
*/

@Test
// @Test
public void TestPrivateMethod_GetCountryByNameWhenServerIsDown() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
setProperties("countryName", "");
assertThrows(NullPointerException.class, () -> reflectPrivateMethod("getCountryByName"));
Expand All @@ -93,7 +93,7 @@ public void TestPrivateMethod_GetAllCountries() throws NoSuchMethodException, In
assertEquals(239, list.size());
}

@Test
// @Test
public void TestPrivateMethod_GetAllCountriesThrowsNullPointerException() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
assertThrows(NullPointerException.class, () -> reflectPrivateMethod("getAllCountries"));
}
Expand All @@ -118,4 +118,34 @@ private List<CountriesEntity> reflectPrivateMethod(String methodName) throws Inv
return set.stream().toList();
}

@Test
public void TestPrivateMethod_GetCountryByRegionEmptyCountryName() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
setProperties("regionName", "");
var list = reflectPrivateMethod("getCountryByRegion");
assertTrue(list.isEmpty());
}

@Test
public void TestPrivateMethod_GetCountryByRegion() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, SQLException {
setProperties("regionName", "Caribbean");
var list = reflectPrivateMethod("getCountryByRegion");

assertEquals(getPropertiesValue("regionName"), list.get(0).getCountryRegion());
}

@Test
public void TestPrivateMethod_GetCountryByContinentEmptyCountryName() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
setProperties("continentName", "");
var list = reflectPrivateMethod("getCountryByContinent");
assertTrue(list.isEmpty());
}

@Test
public void TestPrivateMethod_GetCountryByContinent() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, SQLException {
setProperties("continentName", "Africa");
var list = reflectPrivateMethod("getCountryByContinent");

assertEquals(getPropertiesValue("continentName"), list.get(0).getContinent());
}

}
Loading