@Test public void shouldRemoveAllOccurencesOfAParamFromItsKey() { QueryTestImpl query = this.query.addParam("city", "paris").addParam("name", "toto").addParam("name", "tata"); query.removeParam("name"); assertThat(query.buildParams().toString()).isEqualTo("?city=paris"); }
@Test public void shouldNotCrashWhenRemovingParamOfNoParam() { QueryTestImpl noParam = this.query; assertThat(noParam.removeParam("toto")).isNotNull(); }
@Test public void paramsBuilderShouldSupportListOfParams() { QueryTestImpl withParamList = this.query.addParam("name", "toto").addParam("name", "toto"); assertThat(withParamList.buildParams().toString()).endsWith("name=toto&name=toto"); }
@Test public void paramsBuilderShouldNotEndWithECom() { QueryTestImpl withParams = this.query.addParam("name", "toto").addParam("city", "paris"); assertThat(withParams.buildParams().toString()).endsWith("name=toto&city=paris"); }
@Test public void paramsBuilderShouldBeSeperatedByECom() { QueryTestImpl withParams = this.query.addParam("name", "toto").addParam("city", "paris"); assertThat(withParams.buildParams().toString()).contains("name=toto&city=paris"); }
@Test public void paramsBuilderShouldBeKeyValue() { QueryTestImpl withParams = this.query.addParam("name", "toto"); assertThat(withParams.buildParams().toString()).contains("name=toto"); }
@Test public void paramsBuilderShouldStartWithIntegPointIfThereAreParams() { QueryTestImpl withParams = this.query.addParam("name", "toto"); assertThat(withParams.buildParams().toString()).startsWith("?"); }