@Test public void retrievesStatus() { assertThat(mapper.statusFor(new Exception1()), isValue(REQUEST_TIMEOUT)); }
Optional<HttpResponseStatus> statusFor(Throwable throwable) { List<HttpResponseStatus> matchingStatuses = this.multimap.entries().stream() .filter(entry -> entry.getValue().isInstance(throwable)) .sorted(comparing(entry -> entry.getKey().code())) .map(Map.Entry::getKey) .collect(toList()); if (matchingStatuses.size() > 1) { LOG.error("Multiple matching statuses for throwable={} statuses={}", throwable, matchingStatuses); return Optional.empty(); } return matchingStatuses.stream().findFirst(); }
ExceptionStatusMapper { Optional<HttpResponseStatus> statusFor(Throwable throwable) { List<HttpResponseStatus> matchingStatuses = this.multimap.entries().stream() .filter(entry -> entry.getValue().isInstance(throwable)) .sorted(comparing(entry -> entry.getKey().code())) .map(Map.Entry::getKey) .collect(toList()); if (matchingStatuses.size() > 1) { LOG.error("Multiple matching statuses for throwable={} statuses={}", throwable, matchingStatuses); return Optional.empty(); } return matchingStatuses.stream().findFirst(); } }
ExceptionStatusMapper { Optional<HttpResponseStatus> statusFor(Throwable throwable) { List<HttpResponseStatus> matchingStatuses = this.multimap.entries().stream() .filter(entry -> entry.getValue().isInstance(throwable)) .sorted(comparing(entry -> entry.getKey().code())) .map(Map.Entry::getKey) .collect(toList()); if (matchingStatuses.size() > 1) { LOG.error("Multiple matching statuses for throwable={} statuses={}", throwable, matchingStatuses); return Optional.empty(); } return matchingStatuses.stream().findFirst(); } private  ExceptionStatusMapper(Builder builder); }
ExceptionStatusMapper { Optional<HttpResponseStatus> statusFor(Throwable throwable) { List<HttpResponseStatus> matchingStatuses = this.multimap.entries().stream() .filter(entry -> entry.getValue().isInstance(throwable)) .sorted(comparing(entry -> entry.getKey().code())) .map(Map.Entry::getKey) .collect(toList()); if (matchingStatuses.size() > 1) { LOG.error("Multiple matching statuses for throwable={} statuses={}", throwable, matchingStatuses); return Optional.empty(); } return matchingStatuses.stream().findFirst(); } private  ExceptionStatusMapper(Builder builder);  }
ExceptionStatusMapper { Optional<HttpResponseStatus> statusFor(Throwable throwable) { List<HttpResponseStatus> matchingStatuses = this.multimap.entries().stream() .filter(entry -> entry.getValue().isInstance(throwable)) .sorted(comparing(entry -> entry.getKey().code())) .map(Map.Entry::getKey) .collect(toList()); if (matchingStatuses.size() > 1) { LOG.error("Multiple matching statuses for throwable={} statuses={}", throwable, matchingStatuses); return Optional.empty(); } return matchingStatuses.stream().findFirst(); } private  ExceptionStatusMapper(Builder builder);   }