IdempotencyPredicate implements Predicate<RequestArguments> { @Override public boolean test(final RequestArguments arguments) { return decide(arguments) == Decision.ACCEPT; } IdempotencyPredicate(); @Override boolean test(final RequestArguments arguments);  }
@Test void shouldNotDetectUnrecognizedOverriddenMethod() { assertFalse(unit.test(RequestArguments.create() .withMethod(POST) .withHeader("X-HTTP-Method-Override", "UNKNOWN"))); }
@Test void shouldDetectCaseInsensitiveMethodOverride() { assertTrue(unit.test(RequestArguments.create() .withMethod(POST) .withHeader("x-http-method-override", "GET"))); }
@Test void shouldDetectCallSiteOverride() { assertTrue(unit.test(RequestArguments.create() .withMethod(POST) .withAttribute(IDEMPOTENT, true))); }
@Test void shouldNotDetectNegativeCallSiteOverride() { assertFalse(unit.test(RequestArguments.create() .withMethod(GET) .withAttribute(IDEMPOTENT, false))); }
@Test void shouldDetectIdempotencyKey() { assertTrue(unit.test(RequestArguments.create() .withMethod(POST) .withHeader("Idempotency-Key", "xPkDYMOzZNdBoJ2l"))); }
@Test void shouldDetectIdempotencyKeyCaseInsensitive() { assertTrue(unit.test(RequestArguments.create() .withMethod(POST) .withHeader("idempotency-key", "xPkDYMOzZNdBoJ2l"))); }
@Test void shouldNotDetectOverriddenMethod() { assertFalse(unit.test(RequestArguments.create() .withMethod(POST))); }