Removed obsolete tests

pull/1611/head
Andrea Ceccanti 2021-10-25 17:55:28 +02:00
parent 12bfab4f55
commit 85891ecd39
1 changed files with 44 additions and 42 deletions

View File

@ -16,7 +16,10 @@
package org.mitre.oauth2.service.impl; package org.mitre.oauth2.service.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -31,13 +34,6 @@ import org.springframework.security.oauth2.provider.ClientDetails;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Mockito.when;
import static org.junit.Assert.assertThat;
/** /**
* @author jricher * @author jricher
* *
@ -78,25 +74,29 @@ public class TestBlacklistAwareRedirectResolver {
when(config.isHeartMode()).thenReturn(false); when(config.isHeartMode()).thenReturn(false);
} }
@Test /**
public void testResolveRedirect_safe() { * This is currently and invalid test, it makes invalid assumptions on how the parent resolve
* redirect logic works.
// default uses prefix matching, the first one should work fine *
* @Test public void testResolveRedirect_safe() {
String res1 = resolver.resolveRedirect(goodUri, client); *
* // default uses prefix matching, the first one should work fine
assertThat(res1, is(equalTo(goodUri))); *
* String res1 = resolver.resolveRedirect(goodUri, client);
// set the resolver to non-strict and test the path-based redirect resolution *
* assertThat(res1, is(equalTo(goodUri)));
resolver.setStrictMatch(false); *
* // set the resolver to non-strict and test the path-based redirect resolution
String res2 = resolver.resolveRedirect(pathUri, client); *
* resolver.setStrictMatch(false);
assertThat(res2, is(equalTo(pathUri))); *
* String res2 = resolver.resolveRedirect(pathUri, client);
*
} * assertThat(res2, is(equalTo(pathUri)));
*
*
* }
**/
@Test(expected = InvalidRequestException.class) @Test(expected = InvalidRequestException.class)
public void testResolveRedirect_blacklisted() { public void testResolveRedirect_blacklisted() {
@ -121,23 +121,25 @@ public class TestBlacklistAwareRedirectResolver {
} }
@Test
public void testRedirectMatches_nonstrict() {
// set the resolver to non-strict match mode /**
resolver.setStrictMatch(false); * Test no longer valid
*
// this is not an exact match (but that's OK) * @Test public void testRedirectMatches_nonstrict() {
boolean res1 = resolver.redirectMatches(pathUri, goodUri); *
* // set the resolver to non-strict match mode resolver.setStrictMatch(false);
assertThat(res1, is(true)); *
* // this is not an exact match (but that's OK) boolean res1 =
// this is an exact match * resolver.redirectMatches(pathUri, goodUri);
boolean res2 = resolver.redirectMatches(goodUri, goodUri); *
* assertThat(res1, is(true));
assertThat(res2, is(true)); *
* // this is an exact match boolean res2 = resolver.redirectMatches(goodUri, goodUri);
} *
* assertThat(res2, is(true));
*
* }
**/
@Test @Test
public void testHeartMode() { public void testHeartMode() {