Skip to content

Commit 5007004

Browse files
fold(hitl): R3 round 1 — dedupe setUp endpoint() + narrow exception class
R3 round 1 surfaced two folds against the Java HITL PR: - MED-1: HITLTest.setUp called .endpoint(wmRuntimeInfo.getHttpBaseUrl()) twice on the same builder (copy-paste bug, harmless at runtime but a real code-smell). Collapsed to a single chained call. - MED-5: All three platform-error tests (400 bad-notify_url-scheme, 401 auth, network failure via CONNECTION_RESET_BY_PEER) asserted .isInstanceOf(Exception.class) which would pass even on NullPointerException. Narrowed to AxonFlowException.class to match the @throws AxonFlowException javadoc at AxonFlow.java:6440 and the required-field guard tests at lines 387/397/407 which already narrow to IllegalArgumentException. Tests still green: 25/25 in HITLTest (8 under CreateHITLRequest). Refs getaxonflow/axonflow-enterprise#2421 Signed-off-by: Saurabh Jain <saurabh.jain@getaxonflow.com>
1 parent 00bddf1 commit 5007004

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/test/java/com/getaxonflow/sdk/HITLTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import static com.github.tomakehurst.wiremock.client.WireMock.*;
1919
import static org.assertj.core.api.Assertions.*;
2020

21+
import com.getaxonflow.sdk.exceptions.AxonFlowException;
2122
import com.getaxonflow.sdk.types.hitl.HITLTypes.*;
2223
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
2324
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
@@ -77,11 +78,7 @@ class HITLTest {
7778
@BeforeEach
7879
void setUp(WireMockRuntimeInfo wmRuntimeInfo) {
7980
axonflow =
80-
AxonFlow.create(
81-
AxonFlowConfig.builder()
82-
.endpoint(wmRuntimeInfo.getHttpBaseUrl())
83-
.endpoint(wmRuntimeInfo.getHttpBaseUrl())
84-
.build());
81+
AxonFlow.create(AxonFlowConfig.builder().endpoint(wmRuntimeInfo.getHttpBaseUrl()).build());
8582
}
8683

8784
// ========================================================================
@@ -334,7 +331,8 @@ void shouldSurfaceBadNotifyUrlSchemeAsException() {
334331
.notifyUrl("javascript:alert(1)")
335332
.build();
336333

337-
assertThatThrownBy(() -> axonflow.createHITLRequest(input)).isInstanceOf(Exception.class);
334+
assertThatThrownBy(() -> axonflow.createHITLRequest(input))
335+
.isInstanceOf(AxonFlowException.class);
338336
}
339337

340338
@Test
@@ -355,7 +353,8 @@ void shouldPropagateAuthFailure() {
355353
.requestType("adk-tool")
356354
.build();
357355

358-
assertThatThrownBy(() -> axonflow.createHITLRequest(input)).isInstanceOf(Exception.class);
356+
assertThatThrownBy(() -> axonflow.createHITLRequest(input))
357+
.isInstanceOf(AxonFlowException.class);
359358
}
360359

361360
@Test
@@ -376,7 +375,8 @@ void shouldPropagateNetworkFailure() {
376375
.requestType("adk-tool")
377376
.build();
378377

379-
assertThatThrownBy(() -> axonflow.createHITLRequest(input)).isInstanceOf(Exception.class);
378+
assertThatThrownBy(() -> axonflow.createHITLRequest(input))
379+
.isInstanceOf(AxonFlowException.class);
380380
}
381381

382382
@Test

0 commit comments

Comments
 (0)