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

Class UnknownHostEmitsTest

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

Source from the content-addressed store, hash-verified

296 }
297
298 public static class UnknownHostEmitsTest extends LoggerTest {
299
300 private Level logLevel;
301
302 public void initUnknownHostEmitsTest(Level logLevel, List<String> expectedMessages) {
303 this.logLevel = logLevel;
304 logger.expectMessages(expectedMessages);
305 }
306
307 public static Iterable<Object[]> data() {
308 return Arrays.asList(
309 new Object[][] {
310 {Level.NONE, Collections.emptyList()},
311 {
312 Level.BASIC,
313 Arrays.asList(
314 "\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
315 "\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid"
316 + " \\([0-9]+ms\\)")
317 },
318 {
319 Level.HEADERS,
320 Arrays.asList(
321 "\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
322 "\\[SendsStuff#login\\] Content-Length: 80",
323 "\\[SendsStuff#login\\] Content-Type: application/json",
324 "\\[SendsStuff#login\\] ---> END HTTP \\(80-byte body\\)",
325 "\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid"
326 + " \\([0-9]+ms\\)")
327 },
328 {
329 Level.FULL,
330 Arrays.asList(
331 "\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
332 "\\[SendsStuff#login\\] Content-Length: 80",
333 "\\[SendsStuff#login\\] Content-Type: application/json",
334 "\\[SendsStuff#login\\] ",
335 "\\[SendsStuff#login\\] \\{\"customer_name\": \"netflix\", \"user_name\":"
336 + " \"denominator\", \"password\": \"password\"\\}",
337 "\\[SendsStuff#login\\] ---> END HTTP \\(80-byte body\\)",
338 "\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid"
339 + " \\([0-9]+ms\\)",
340 "(?s)\\[SendsStuff#login\\] java.net.UnknownHostException: non-exist.invalid.*",
341 "\\[SendsStuff#login\\] <--- END ERROR")
342 }
343 });
344 }
345
346 @MethodSource("data")
347 @ParameterizedTest
348 void unknownHostEmits(Level logLevel, List<String> expectedMessages) {
349 initUnknownHostEmitsTest(logLevel, expectedMessages);
350 SendsStuff api =
351 Feign.builder()
352 .logger(logger)
353 .logLevel(logLevel)
354 .retryer(
355 new Retryer() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected