@@ -212,46 +212,44 @@ private void withProtocol(final Protocol protocol)
212212 @ Override
213213 public boolean matches (final MatchDifference context , final RequestDefinition requestDefinition )
214214 {
215- if (requestDefinition instanceof final HttpRequest request )
215+ if (!( requestDefinition instanceof final HttpRequest request ) )
216216 {
217- final StringBuilder becauseBuilder = new StringBuilder ();
218- final boolean overallMatch = this .matches (context , request , becauseBuilder );
219- if (!this .controlPlaneMatcher )
217+ return requestDefinition == null ;
218+ }
219+
220+ final StringBuilder becauseBuilder = new StringBuilder ();
221+ final boolean overallMatch = this .matches (context , request , becauseBuilder );
222+ if (!this .controlPlaneMatcher )
223+ {
224+ if (overallMatch )
220225 {
221- if (overallMatch )
226+ if (LOG . isInfoEnabled () )
222227 {
223- if (LOG .isInfoEnabled ())
224- {
225- LOG .info (
226- this .expectation == null ? REQUEST_DID_MATCH : EXPECTATION_DID_MATCH ,
227- request ,
228- this .expectation == null ? this : this .expectation .clone ());
229- }
228+ LOG .info (
229+ this .expectation == null ? REQUEST_DID_MATCH : EXPECTATION_DID_MATCH ,
230+ request ,
231+ this .expectation == null ? this : this .expectation .clone ());
230232 }
231- else
233+ }
234+ else
235+ {
236+ becauseBuilder .replace (0 , 1 , "" );
237+ final String because = becauseBuilder .toString ();
238+ if (LOG .isInfoEnabled ())
232239 {
233- becauseBuilder .replace (0 , 1 , "" );
234- final String because = becauseBuilder .toString ();
235- if (LOG .isInfoEnabled ())
236- {
237- LOG .info (
238- this .expectation == null
239- ? this .didNotMatchRequestBecause
240- : !becauseBuilder .isEmpty ()
241- ? this .didNotMatchExpectationBecause
242- : this .didNotMatchExpectationWithoutBecause ,
243- request ,
244- this .expectation == null ? this : this .expectation .clone (),
245- because );
246- }
240+ LOG .info (
241+ this .expectation == null
242+ ? this .didNotMatchRequestBecause
243+ : !becauseBuilder .isEmpty ()
244+ ? this .didNotMatchExpectationBecause
245+ : this .didNotMatchExpectationWithoutBecause ,
246+ request ,
247+ this .expectation == null ? this : this .expectation .clone (),
248+ because );
247249 }
248250 }
249- return overallMatch ;
250- }
251- else
252- {
253- return requestDefinition == null ;
254251 }
252+ return overallMatch ;
255253 }
256254
257255 @ SuppressWarnings ({
0 commit comments