MCPcopy Index your code
hub / github.com/OpenFeign/feign / RetryEmitsTest

Class RetryEmitsTest

core/src/test/java/feign/LoggerTest.java:446–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444 }
445
446 public static class RetryEmitsTest extends LoggerTest {
447
448 private Level logLevel;
449
450 public void initRetryEmitsTest(Level logLevel, List<String> expectedMessages) {
451 this.logLevel = logLevel;
452 logger.expectMessages(expectedMessages);
453 }
454
455 public static Iterable<Object[]> data() {
456 return Arrays.asList(
457 new Object[][] {
458 {Level.NONE, Collections.emptyList()},
459 {
460 Level.BASIC,
461 Arrays.asList(
462 "\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
463 "\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid"
464 + " \\([0-9]+ms\\)",
465 "\\[SendsStuff#login\\] ---> RETRYING",
466 "\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
467 "\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid"
468 + " \\([0-9]+ms\\)")
469 }
470 });
471 }
472
473 @MethodSource("data")
474 @ParameterizedTest
475 void retryEmits(Level logLevel, List<String> expectedMessages) {
476
477 initRetryEmitsTest(logLevel, expectedMessages);
478
479 SendsStuff api =
480 Feign.builder()
481 .logger(logger)
482 .logLevel(logLevel)
483 .retryer(
484 new Retryer() {
485 boolean retried;
486
487 @Override
488 public void continueOrPropagate(RetryableException e) {
489 if (!retried) {
490 retried = true;
491 return;
492 }
493 throw e;
494 }
495
496 @Override
497 public Retryer clone() {
498 return this;
499 }
500 })
501 .target(SendsStuff.class, "http://non-exist.invalid");
502
503 assertThrows(FeignException.class, () -> api.login("netflix", "denominator", "password"));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected