From a1ecf63ae68e5d753c7bce9a46edeeea26ac2f5e Mon Sep 17 00:00:00 2001 From: Davide Angelocola Date: Sun, 21 Jun 2026 12:35:04 +0200 Subject: [PATCH] test(reader): unit-cover VortexHttpReader.open(uri, registry) overload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prior IT (#116) exercised the two-arg overload but @Tag("integration") *IT classes run under failsafe, not surefire, so JaCoCo/Sonar never saw them — new-code coverage stayed at 50% and the quality gate stayed red. Replace it with a surefire unit test: a non-HTTP URI makes HttpRequest.newBuilder reject the scheme before any socket opens, so the delegation line runs offline with no real network I/O. Co-Authored-By: Claude Opus 4.8 --- .../vortex/reader/VortexHttpReaderIT.java | 15 ------------ .../VortexHttpReaderOpenOverloadTest.java | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 reader/src/test/java/io/github/dfa1/vortex/reader/VortexHttpReaderOpenOverloadTest.java diff --git a/reader/src/test/java/io/github/dfa1/vortex/reader/VortexHttpReaderIT.java b/reader/src/test/java/io/github/dfa1/vortex/reader/VortexHttpReaderIT.java index 061473ac..da3c087b 100644 --- a/reader/src/test/java/io/github/dfa1/vortex/reader/VortexHttpReaderIT.java +++ b/reader/src/test/java/io/github/dfa1/vortex/reader/VortexHttpReaderIT.java @@ -61,21 +61,6 @@ void open_remoteFile_layoutRowCountIsPositive() throws Exception { } } - @Test - void open_withCustomRegistry_parsesMetadata() throws Exception { - // Given the two-arg overload: caller supplies a registry, default shared HttpClient. - // The three-arg overload is exercised by the mock-client unit tests, but this - // delegating overload was otherwise untested. - - // When - try (var sut = VortexHttpReader.open(FOR_ARRAY, ReadRegistry.loadAll())) { - - // Then - assertThat(sut.version()).isEqualTo(1); - assertThat(sut.dtype()).isNotNull(); - } - } - @Test void scan_forVortex_decodesAllRows() throws Exception { // Given diff --git a/reader/src/test/java/io/github/dfa1/vortex/reader/VortexHttpReaderOpenOverloadTest.java b/reader/src/test/java/io/github/dfa1/vortex/reader/VortexHttpReaderOpenOverloadTest.java new file mode 100644 index 00000000..9ba24d22 --- /dev/null +++ b/reader/src/test/java/io/github/dfa1/vortex/reader/VortexHttpReaderOpenOverloadTest.java @@ -0,0 +1,23 @@ +package io.github.dfa1.vortex.reader; + +import org.junit.jupiter.api.Test; + +import java.net.URI; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +/// Unit coverage for the [VortexHttpReader#open(URI, ReadRegistry)] overload, which wires the +/// shared default [java.net.http.HttpClient]. A non-HTTP URI makes the request builder reject +/// the scheme before any socket is opened, so the delegation runs without real network I/O. +class VortexHttpReaderOpenOverloadTest { + + @Test + void open_uriAndRegistry_delegatesToDefaultClient() { + // Given a URI whose scheme HttpRequest.newBuilder rejects (no network performed) + URI uri = URI.create("ftp://example.invalid/file.vortex"); + + // When / Then the two-arg overload runs and surfaces the rejection + assertThatThrownBy(() -> VortexHttpReader.open(uri, ReadRegistry.empty())) + .isInstanceOf(IllegalArgumentException.class); + } +}