UrlValidator implements Validator { @Override public boolean validate(final ProcessingClient client) { final String text = client.getText(); try { new URL(text); return true; } catch (final Exception ex) { LOGGER.error("Wrong URL: {}.", text, ex); return false; } }  @Override boolean validate(final ProcessingClient client);  }
@Test void testCorrect() { when(client.getText()).thenReturn("http: assertThat(validator.validate(client)).isTrue(); }
@Test void testIncorrect() { when(client.getText()).thenReturn("adsf"); assertThat(validator.validate(client)).isFalse(); }
@Test void testEmpty() { when(client.getText()).thenReturn(""); assertThat(validator.validate(client)).isFalse(); }
@Test void testNull() { assertThat(validator.validate(client)).isFalse(); }