Example #1
0
 @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");
 }
Example #2
0
 @Test
 public void shouldNotCrashWhenRemovingParamOfNoParam() {
   QueryTestImpl noParam = this.query;
   assertThat(noParam.removeParam("toto")).isNotNull();
 }
Example #3
0
 @Test
 public void paramsBuilderShouldSupportListOfParams() {
   QueryTestImpl withParamList = this.query.addParam("name", "toto").addParam("name", "toto");
   assertThat(withParamList.buildParams().toString()).endsWith("name=toto&name=toto");
 }
Example #4
0
 @Test
 public void paramsBuilderShouldNotEndWithECom() {
   QueryTestImpl withParams = this.query.addParam("name", "toto").addParam("city", "paris");
   assertThat(withParams.buildParams().toString()).endsWith("name=toto&city=paris");
 }
Example #5
0
 @Test
 public void paramsBuilderShouldBeSeperatedByECom() {
   QueryTestImpl withParams = this.query.addParam("name", "toto").addParam("city", "paris");
   assertThat(withParams.buildParams().toString()).contains("name=toto&city=paris");
 }
Example #6
0
 @Test
 public void paramsBuilderShouldBeKeyValue() {
   QueryTestImpl withParams = this.query.addParam("name", "toto");
   assertThat(withParams.buildParams().toString()).contains("name=toto");
 }
Example #7
0
 @Test
 public void paramsBuilderShouldStartWithIntegPointIfThereAreParams() {
   QueryTestImpl withParams = this.query.addParam("name", "toto");
   assertThat(withParams.buildParams().toString()).startsWith("?");
 }