Refactor response handling with ResponseValidator class
Introduced a new ResponseValidator class to encapsulate response validation logic, improving code readability and maintainability. Updated CfDnsClient to delegate response validation to this new class. Adjusted tests to align with the refactor and ensure proper exception handling.
This commit is contained in:
@@ -36,11 +36,14 @@ public class CfClientTest {
|
||||
|
||||
assertThrows(CloudflareNotFoundException.class,
|
||||
() -> client.sldListAll(zList.get(0), "not-existing"));
|
||||
}
|
||||
|
||||
client.setEmptyResultThrowsException(false);
|
||||
rList = client.sldListAll(zList.get(0), "not-existing");
|
||||
assertTrue(rList.isEmpty());
|
||||
client.setEmptyResultThrowsException(true);
|
||||
@Test
|
||||
void testEmptyResultThrowsException() throws Exception {
|
||||
List<ZoneEntity> zList = client.zoneListAll();
|
||||
CfDnsClient client = new CfDnsClient(true, API_EMAIL, API_KEY);
|
||||
assertThrows(CloudflareNotFoundException.class,
|
||||
() -> client.sldListAll(zList.get(0), "not-existing"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user