Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Sep 27, 2023
1 parent b5db730 commit 45d8aad
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,55 +32,55 @@
* @author Rossen Stoyanchev
* @author Stephane Nicoll
*/
public class ParamsRequestConditionTests {
class ParamsRequestConditionTests {

@Test
public void paramEquals() {
void paramEquals() {
assertThat(new ParamsRequestCondition("foo")).isEqualTo(new ParamsRequestCondition("foo"));
assertThat(new ParamsRequestCondition("foo").equals(new ParamsRequestCondition("bar"))).isFalse();
assertThat(new ParamsRequestCondition("foo").equals(new ParamsRequestCondition("FOO"))).isFalse();
assertThat(new ParamsRequestCondition("foo")).isNotEqualTo(new ParamsRequestCondition("bar"));
assertThat(new ParamsRequestCondition("foo")).isNotEqualTo(new ParamsRequestCondition("FOO"));
assertThat(new ParamsRequestCondition("foo=bar")).isEqualTo(new ParamsRequestCondition("foo=bar"));
assertThat(new ParamsRequestCondition("foo=bar").equals(new ParamsRequestCondition("FOO=bar"))).isFalse();
assertThat(new ParamsRequestCondition("foo=bar")).isNotEqualTo(new ParamsRequestCondition("FOO=bar"));
}

@Test
public void paramPresent() {
void paramPresent() {
ParamsRequestCondition condition = new ParamsRequestCondition("foo");
assertThat(condition.getMatchingCondition(MockServerWebExchange.from(get("/path?foo=")))).isNotNull();
}

@Test // SPR-15831
public void paramPresentNullValue() {
void paramPresentNullValue() {
ParamsRequestCondition condition = new ParamsRequestCondition("foo");
assertThat(condition.getMatchingCondition(MockServerWebExchange.from(get("/path?foo")))).isNotNull();
}

@Test
public void paramPresentNoMatch() {
void paramPresentNoMatch() {
ParamsRequestCondition condition = new ParamsRequestCondition("foo");
assertThat(condition.getMatchingCondition(MockServerWebExchange.from(get("/path?bar=")))).isNull();
}

@Test
public void paramNotPresent() {
void paramNotPresent() {
MockServerWebExchange exchange = MockServerWebExchange.from(get("/"));
assertThat(new ParamsRequestCondition("!foo").getMatchingCondition(exchange)).isNotNull();
}

@Test
public void paramValueMatch() {
void paramValueMatch() {
ParamsRequestCondition condition = new ParamsRequestCondition("foo=bar");
assertThat(condition.getMatchingCondition(MockServerWebExchange.from(get("/path?foo=bar")))).isNotNull();
}

@Test
public void paramValueNoMatch() {
void paramValueNoMatch() {
ParamsRequestCondition condition = new ParamsRequestCondition("foo=bar");
assertThat(condition.getMatchingCondition(MockServerWebExchange.from(get("/path?foo=bazz")))).isNull();
}

@Test
public void compareTo() {
void compareTo() {
ServerWebExchange exchange = MockServerWebExchange.from(get("/"));

ParamsRequestCondition condition1 = new ParamsRequestCondition("foo", "bar", "baz");
Expand All @@ -94,7 +94,7 @@ public void compareTo() {
}

@Test // SPR-16674
public void compareToWithMoreSpecificMatchByValue() {
void compareToWithMoreSpecificMatchByValue() {
ServerWebExchange exchange = MockServerWebExchange.from(get("/"));

ParamsRequestCondition condition1 = new ParamsRequestCondition("response_type=code");
Expand All @@ -105,7 +105,7 @@ public void compareToWithMoreSpecificMatchByValue() {
}

@Test
public void compareToWithNegatedMatch() {
void compareToWithNegatedMatch() {
ServerWebExchange exchange = MockServerWebExchange.from(get("/"));

ParamsRequestCondition condition1 = new ParamsRequestCondition("response_type!=code");
Expand All @@ -115,7 +115,7 @@ public void compareToWithNegatedMatch() {
}

@Test
public void combineWitOtherEmpty() {
void combineWithOtherEmpty() {
ParamsRequestCondition condition1 = new ParamsRequestCondition("foo=bar");
ParamsRequestCondition condition2 = new ParamsRequestCondition();

Expand All @@ -124,7 +124,7 @@ public void combineWitOtherEmpty() {
}

@Test
public void combineWitThisEmpty() {
void combineWithThisEmpty() {
ParamsRequestCondition condition1 = new ParamsRequestCondition();
ParamsRequestCondition condition2 = new ParamsRequestCondition("foo=bar");

Expand All @@ -133,7 +133,7 @@ public void combineWitThisEmpty() {
}

@Test
public void combine() {
void combine() {
ParamsRequestCondition condition1 = new ParamsRequestCondition("foo=bar");
ParamsRequestCondition condition2 = new ParamsRequestCondition("foo=baz");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,67 +31,67 @@
* @author Arjen Poutsma
* @author Stephane Nicoll
*/
public class ParamsRequestConditionTests {
class ParamsRequestConditionTests {

@Test
public void paramEquals() {
void paramEquals() {
assertThat(new ParamsRequestCondition("foo")).isEqualTo(new ParamsRequestCondition("foo"));
assertThat(new ParamsRequestCondition("foo").equals(new ParamsRequestCondition("bar"))).isFalse();
assertThat(new ParamsRequestCondition("foo").equals(new ParamsRequestCondition("FOO"))).isFalse();
assertThat(new ParamsRequestCondition("foo")).isNotEqualTo(new ParamsRequestCondition("bar"));
assertThat(new ParamsRequestCondition("foo")).isNotEqualTo(new ParamsRequestCondition("FOO"));
assertThat(new ParamsRequestCondition("foo=bar")).isEqualTo(new ParamsRequestCondition("foo=bar"));
assertThat(new ParamsRequestCondition("foo=bar").equals(new ParamsRequestCondition("FOO=bar"))).isFalse();
assertThat(new ParamsRequestCondition("foo=bar")).isNotEqualTo(new ParamsRequestCondition("FOO=bar"));
}

@Test
public void paramPresent() {
void paramPresent() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter("foo", "");

assertThat(new ParamsRequestCondition("foo").getMatchingCondition(request)).isNotNull();
}

@Test // SPR-15831
public void paramPresentNullValue() {
void paramPresentNullValue() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter("foo", (String) null);

assertThat(new ParamsRequestCondition("foo").getMatchingCondition(request)).isNotNull();
}

@Test
public void paramPresentNoMatch() {
void paramPresentNoMatch() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("bar", "");

assertThat(new ParamsRequestCondition("foo").getMatchingCondition(request)).isNull();
}

@Test
public void paramNotPresent() {
void paramNotPresent() {
ParamsRequestCondition condition = new ParamsRequestCondition("!foo");
MockHttpServletRequest request = new MockHttpServletRequest();

assertThat(condition.getMatchingCondition(request)).isNotNull();
}

@Test
public void paramValueMatch() {
void paramValueMatch() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter("foo", "bar");

assertThat(new ParamsRequestCondition("foo=bar").getMatchingCondition(request)).isNotNull();
}

@Test
public void paramValueNoMatch() {
void paramValueNoMatch() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter("foo", "bazz");

assertThat(new ParamsRequestCondition("foo=bar").getMatchingCondition(request)).isNull();
}

@Test
public void compareTo() {
void compareTo() {
MockHttpServletRequest request = new MockHttpServletRequest();

ParamsRequestCondition condition1 = new ParamsRequestCondition("foo", "bar", "baz");
Expand All @@ -105,7 +105,7 @@ public void compareTo() {
}

@Test // SPR-16674
public void compareToWithMoreSpecificMatchByValue() {
void compareToWithMoreSpecificMatchByValue() {
MockHttpServletRequest request = new MockHttpServletRequest();

ParamsRequestCondition condition1 = new ParamsRequestCondition("response_type=code");
Expand All @@ -116,7 +116,7 @@ public void compareToWithMoreSpecificMatchByValue() {
}

@Test
public void compareToWithNegatedMatch() {
void compareToWithNegatedMatch() {
MockHttpServletRequest request = new MockHttpServletRequest();

ParamsRequestCondition condition1 = new ParamsRequestCondition("response_type!=code");
Expand All @@ -126,7 +126,7 @@ public void compareToWithNegatedMatch() {
}

@Test
public void combineWithOtherEmpty() {
void combineWithOtherEmpty() {
ParamsRequestCondition condition1 = new ParamsRequestCondition("foo=bar");
ParamsRequestCondition condition2 = new ParamsRequestCondition();

Expand All @@ -135,7 +135,7 @@ public void combineWithOtherEmpty() {
}

@Test
public void combineWithThisEmpty() {
void combineWithThisEmpty() {
ParamsRequestCondition condition1 = new ParamsRequestCondition();
ParamsRequestCondition condition2 = new ParamsRequestCondition("foo=bar");

Expand All @@ -144,7 +144,7 @@ public void combineWithThisEmpty() {
}

@Test
public void combine() {
void combine() {
ParamsRequestCondition condition1 = new ParamsRequestCondition("foo=bar");
ParamsRequestCondition condition2 = new ParamsRequestCondition("foo=baz");

Expand Down

0 comments on commit 45d8aad

Please sign in to comment.