HttpServices { static boolean shouldLogException(Throwable t) { if (t instanceof InterruptedException) { logger.debug(t.getMessage(), t); return false; } if (t instanceof IOException && BROWSER_DISCONNECT_MESSAGES.contains(t.getMessage())) { logger.debug(t.getMessage(), t); return false; } if (t instanceof ClosedChannelException) { logger.debug(t.getMessage(), t); return false; } return true; } private  HttpServices();   }
@Test public void shouldLogRegularException() { Exception e = new Exception(); assertThat(HttpServices.shouldLogException(e)).isTrue(); }
@Test public void shouldNotLogInterruptedException() { Exception e = new InterruptedException(); assertThat(HttpServices.shouldLogException(e)).isFalse(); }
@Test public void shouldNotLogClosedChannelException() { Exception e = new ClosedChannelException(); assertThat(HttpServices.shouldLogException(e)).isFalse(); }
@Test public void shouldNotLogBrowserDisconnectMessageException() { Exception e = new IOException("An existing connection was forcibly closed by the remote host"); assertThat(HttpServices.shouldLogException(e)).isFalse(); }
@Test public void shouldLogRegularIOException() { Exception e = new IOException(); assertThat(HttpServices.shouldLogException(e)).isTrue(); }