MotechURL { @Override public String toString() { return this.url; } MotechURL(String url); @Override String toString(); String getHost(); static final String URL_PATTERN; }
@Test public void shouldReturnUrlWithHttpProtocolIfProtocolNotPresentInitially() { MotechURL record = new MotechURL("some.url"); assertThat(record.toString(), Is.is("http: }
@Test public void shouldRetainTheProtocolIfPresent() { MotechURL record = new MotechURL("xyz: assertThat(record.toString(), Is.is("xyz: }
@Test public void blankUrlShouldBeReturnedAsBlank() { MotechURL nullUrl = new MotechURL(null); assertThat(nullUrl.toString(), nullValue()); MotechURL emptyUrl = new MotechURL(" "); assertThat(emptyUrl.toString(), Is.is(EMPTY)); }
@Test public void urlShouldBeTrimmed() { MotechURL url = new MotechURL(" https: assertThat(url.toString(), Is.is("https: }