fixed unit test for new default redirect behavior

pull/823/merge
Justin Richer 2017-05-11 11:27:41 -04:00
parent 2f31ceddf8
commit c11e47a75b
1 changed files with 10 additions and 4 deletions

View File

@ -82,12 +82,16 @@ public class TestBlacklistAwareRedirectResolver {
@Test @Test
public void testResolveRedirect_safe() { public void testResolveRedirect_safe() {
// default uses prefix matching, both of these should work // default uses prefix matching, the first one should work fine
String res1 = resolver.resolveRedirect(goodUri, client); String res1 = resolver.resolveRedirect(goodUri, client);
assertThat(res1, is(equalTo(goodUri))); assertThat(res1, is(equalTo(goodUri)));
// set the resolver to non-strict and test the path-based redirect resolution
resolver.setStrictMatch(false);
String res2 = resolver.resolveRedirect(pathUri, client); String res2 = resolver.resolveRedirect(pathUri, client);
assertThat(res2, is(equalTo(pathUri))); assertThat(res2, is(equalTo(pathUri)));
@ -104,8 +108,7 @@ public class TestBlacklistAwareRedirectResolver {
} }
@Test @Test
public void testRedirectMatches_strict() { public void testRedirectMatches_default() {
resolver.setStrictMatch(true);
// this is not an exact match // this is not an exact match
boolean res1 = resolver.redirectMatches(pathUri, goodUri); boolean res1 = resolver.redirectMatches(pathUri, goodUri);
@ -120,7 +123,10 @@ public class TestBlacklistAwareRedirectResolver {
} }
@Test @Test
public void testRedirectMatches_default() { public void testRedirectMatches_nonstrict() {
// set the resolver to non-strict match mode
resolver.setStrictMatch(false);
// this is not an exact match (but that's OK) // this is not an exact match (but that's OK)
boolean res1 = resolver.redirectMatches(pathUri, goodUri); boolean res1 = resolver.redirectMatches(pathUri, goodUri);