Beispiel #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");
 }
Beispiel #2
0
 @Test
 public void shouldNotCrashWhenRemovingParamOfNoParam() {
   QueryTestImpl noParam = this.query;
   assertThat(noParam.removeParam("toto")).isNotNull();
 }
Beispiel #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");
 }
Beispiel #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");
 }
Beispiel #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");
 }
Beispiel #6
0
 @Test
 public void paramsBuilderShouldBeKeyValue() {
   QueryTestImpl withParams = this.query.addParam("name", "toto");
   assertThat(withParams.buildParams().toString()).contains("name=toto");
 }
Beispiel #7
0
 @Test
 public void paramsBuilderShouldStartWithIntegPointIfThereAreParams() {
   QueryTestImpl withParams = this.query.addParam("name", "toto");
   assertThat(withParams.buildParams().toString()).startsWith("?");
 }