update README and fix "getRecord" wording in docs and messages
Build and Analyse / build-and-analyse (push) Successful in 24s

- README: fix fluent API examples (getRecord), complete recordCreate
  docs, document paging, groupRecordsByFqdn, recordDelete by id and
  multiple types in recordDeleteTypeIfExists, mention Java 17
- replace stray "getRecord" wording with "record" in javadoc, log and
  exception messages

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
thischwaandClaude Opus 5.5 committed 2026-10-31 12:25:27 +01:00
1 parent d2acc3ce74
commit 31229ff627
15 files changed
+202 -162

No files matched your search

@@ -66,7 +66,7 @@ public class CfClientPenTest {
}
@Test
@DisplayName("Invalid getRecord content and TTL boundaries must be rejected by API")
@DisplayName("Invalid record content and TTL boundaries must be rejected by API")
void testInvalidRecordCreateInputsRejected() throws Exception {
CfDnsClient client = newClient();
ZoneEntity zone = client.zoneGet(ZONE_STR);
@@ -81,11 +81,11 @@ public class CfClientPenTest {
}
try {
// A getRecord with invalid IPv4
// A record with invalid IPv4
assertThrows(CloudflareApiException.class,
() -> client.recordCreate(zone, fqdn, 60, RecordType.A, "999.999.999.999"));
// AAAA getRecord with non-IP content
// AAAA record with non-IP content
assertThrows(CloudflareApiException.class,
() -> client.recordCreate(zone, fqdn, 60, RecordType.AAAA, "not-an-ipv6"));
@@ -144,7 +144,7 @@ public class CfClientTest {
// ensure clean state
client.recordDeleteTypeIfExists(z, randomSld, RecordType.A, RecordType.AAAA);
// create A getRecord using recordCreate with full domain
// create A record using recordCreate with full domain
createdRe1 =
client.recordCreate(z, RecordEntity.build(domain, RecordType.A, TTL, "130.0.0.3"));
assertNotNull(createdRe1.getId());
@@ -163,7 +163,7 @@ public class CfClientTest {
r = aRecords.get(0);
assertEquals("130.0.0.3", r.getContent());
// create AAAA getRecord using recordCreateSld
// create AAAA record using recordCreateSld
createdRe2 =
client.recordCreateSld(z, randomSld, TTL, RecordType.AAAA, "2a0a:4cc0:c0:2e4::1");
List<RecordEntity> aaaaRecords = client.recordList(z, randomSld, RecordType.AAAA);
@@ -183,7 +183,7 @@ public class CfClientTest {
} else if (Objects.equals(re.getType(), RecordType.AAAA.getType())) {
assertEquals("2a0a:4cc0:c0:2e4::1", re.getContent());
} else {
fail(String.format("Unexpected getRecord type: %s", re.getType()));
fail(String.format("Unexpected record type: %s", re.getType()));
}
}
@@ -207,7 +207,7 @@ public class CfClientTest {
assertFalse(fluentList.isEmpty());
assertTrue(fluentList.stream().anyMatch(re -> re.getId().equals(createdRe1.getId())));
// update AAAA getRecord
// update AAAA record
createdRe2.setContent("2a0a:4cc0:c0:2e4::2");
client.recordUpdate(z, createdRe2);
aaaaRecords = client.recordList(z, randomSld, RecordType.AAAA);
@@ -215,18 +215,18 @@ public class CfClientTest {
r = aaaaRecords.get(0);
assertEquals("2a0a:4cc0:c0:2e4::2", r.getContent());
// verify A getRecord still intact
// verify A record still intact
aRecords = client.recordList(z, randomSld, RecordType.A);
assertEquals(1, aRecords.size());
r = aRecords.get(0);
assertEquals("130.0.0.3", r.getContent());
// delete AAAA getRecord and verify it's gone
// delete AAAA record and verify it's gone
assertTrue(client.recordDelete(z, createdRe2));
assertThrows(CloudflareNotFoundException.class,
() -> client.recordList(z, randomSld, RecordType.AAAA));
// delete A getRecord using helper and verify it's gone
// delete A record using helper and verify it's gone
client.recordDeleteTypeIfExists(z, randomSld, RecordType.A);
assertThrows(CloudflareNotFoundException.class,
() -> client.recordList(z, randomSld, RecordType.A));
@@ -242,7 +242,7 @@ public class CfClientTest {
void testRecordEntityInvalidType() {
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class,
() -> RecordEntity.build("id123", "example.com", "INVALID_TYPE", 60, "192.168.1.1"));
assertTrue(exception.getMessage().contains("Invalid getRecord type: INVALID_TYPE"));
assertTrue(exception.getMessage().contains("Invalid record type: INVALID_TYPE"));
assertTrue(exception.getMessage().contains("Must be one of:"));
}
@@ -441,7 +441,7 @@ public class CfClientTest {
assertNotNull(groupedRecords, "Resulting map should not be null.");
assertEquals(2, groupedRecords.size(), "The grouping should result in 2 FQDN keys.");
assertEquals(2, groupedRecords.get("example.com.").size(), "The key 'example.com.' should have 2 records.");
assertEquals(1, groupedRecords.get("sub.example.com.").size(), "The key 'sub.example.com.' should have 1 getRecord.");
assertEquals(1, groupedRecords.get("sub.example.com.").size(), "The key 'sub.example.com.' should have 1 record.");
}
@Test