Skip to content

Commit de44358

Browse files
committed
Fix ambiguous tryCommitBlockingResponse mock after rebase
Master (#12519) added a default BlockResponseFunction.tryCommitBlockingResponse(RequestContext, RequestBlockingAction) overload alongside the existing TraceSegment-based one, making bare any() matchers ambiguous. Disambiguate with any(TraceSegment.class), matching the overload GlassFishBlockingHelper actually invokes via BlockFailureReporter.
1 parent 1be3e57 commit de44358

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎dd-java-agent/instrumentation/tomcat/tomcat-appsec/tomcat-appsec-7.0/src/test/java/datadog/trace/instrumentation/tomcat7/GlassFishBlockingHelperTest.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ void tryBlock_commitThrows_reportsBlockFailure() throws Exception {
241241
AppSecContext appSecCtx = mockAppSecCtx(reqCtx);
242242
doThrow(new RuntimeException("commit failed"))
243243
.when(brf)
244-
.tryCommitBlockingResponse(any(), any(Flow.Action.RequestBlockingAction.class));
244+
.tryCommitBlockingResponse(
245+
any(TraceSegment.class), any(Flow.Action.RequestBlockingAction.class));
245246

246247
assertFalse(GlassFishBlockingHelper.tryBlock(reqCtx, null, null, rba(403)));
247248

@@ -412,7 +413,8 @@ private static RequestContext mockReqCtx(BlockResponseFunction brf, TraceSegment
412413
/** A {@link BlockResponseFunction} whose commit attempt succeeds. */
413414
private static BlockResponseFunction mockCommittingBrf() {
414415
BlockResponseFunction brf = mock(BlockResponseFunction.class);
415-
when(brf.tryCommitBlockingResponse(any(), any(Flow.Action.RequestBlockingAction.class)))
416+
when(brf.tryCommitBlockingResponse(
417+
any(TraceSegment.class), any(Flow.Action.RequestBlockingAction.class)))
416418
.thenReturn(true);
417419
return brf;
418420
}

0 commit comments

Comments
 (0)