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:
thischwa committed 2025-04-25 18:56:35 +02:00
1 parent e33318e989
commit 697906a669
3 files changed
+86 -32

No files matched your search

@@ -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