diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61fc12c..ebe3387 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,12 @@ jobs: - name: Build and verify with JaCoCo coverage gate run: mvn -B --no-transfer-progress clean verify + - name: Verify direct Surefire without agent initialization + run: mvn -B --no-transfer-progress surefire:test + + - name: Verify tests with JaCoCo disabled + run: mvn -B --no-transfer-progress test -Djacoco.skip=true + - name: Upload JaCoCo coverage report if: always() uses: actions/upload-artifact@v7 diff --git a/pom.xml b/pom.xml index 46e950b..e05bafe 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,8 @@ + + 17 ${java.version} ${java.version} diff --git a/src/test/java/io/github/easy4j/opencode/OpenCodeHttpClientConfigTest.java b/src/test/java/io/github/easy4j/opencode/OpenCodeHttpClientConfigTest.java index d8d0382..a489e14 100644 --- a/src/test/java/io/github/easy4j/opencode/OpenCodeHttpClientConfigTest.java +++ b/src/test/java/io/github/easy4j/opencode/OpenCodeHttpClientConfigTest.java @@ -86,4 +86,44 @@ void jsonBindsBothPropertyNamesAndRoundTrips() throws Exception { assertEquals(config, mapper.readValue(mapper.writeValueAsString(config), OpenCodeHttpClientConfig.class)); } } + + @Test + void jsonOutputExposesEqualCanonicalAndLegacyValues() throws Exception { + com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper(); + OpenCodeHttpClientConfig config = new OpenCodeHttpClientConfig(); + config.setBaseUrl("http://output:4096"); + config.setStreamEventQueueCapacity(41); + com.fasterxml.jackson.databind.JsonNode json = mapper.valueToTree(config); + assertEquals("http://output:4096", json.get("baseUrl").asText()); + assertEquals(json.get("baseUrl"), json.get("serverUrl")); + assertEquals(41, json.get("streamEventQueueCapacity").asInt()); + assertEquals(json.get("streamEventQueueCapacity"), json.get("sseEventQueueCapacity")); + } + + @Test + void conflictingJsonNamesUseLastValueInDocumentOrder() throws Exception { + com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper(); + OpenCodeHttpClientConfig canonicalLast = mapper.readValue(""" + {"serverUrl":"http://legacy:4096","baseUrl":"http://canonical:4096", + "sseEventQueueCapacity":11,"streamEventQueueCapacity":22} + """, OpenCodeHttpClientConfig.class); + assertEquals("http://canonical:4096", canonicalLast.getServerUrl()); + assertEquals(22, canonicalLast.getSseEventQueueCapacity()); + OpenCodeHttpClientConfig legacyLast = mapper.readValue(""" + {"baseUrl":"http://canonical:4096","serverUrl":"http://legacy:4096", + "streamEventQueueCapacity":22,"sseEventQueueCapacity":11} + """, OpenCodeHttpClientConfig.class); + assertEquals("http://legacy:4096", legacyLast.getBaseUrl()); + assertEquals(11, legacyLast.getStreamEventQueueCapacity()); + } + + @Test + void jsonAliasesAlsoBindNestedHttpConfiguration() throws Exception { + com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper(); + OpenCodeClientConfig config = mapper.readValue(""" + {"http":{"serverUrl":"http://nested:4096","sseEventQueueCapacity":19}} + """, OpenCodeClientConfig.class); + assertEquals("http://nested:4096", config.getHttp().getBaseUrl()); + assertEquals(19, config.getHttp().getStreamEventQueueCapacity()); + } }