Remove superfluous comments

Remove a few comments that previously add noise but don't offer a great
deal of value.

Issue gh-8945
This commit is contained in:
Phillip Webb
2020-07-29 00:19:27 -07:00
committed by Rob Winch
parent 8d80166aaf
commit 31ec450d05
28 changed files with 7 additions and 304 deletions

View File

@@ -51,80 +51,63 @@ public class ExpressionBasedPreInvocationAdviceTests {
@Test(expected = IllegalArgumentException.class)
public void findFilterTargetNameProvidedButNotMatch() throws Exception {
// given
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "filterTargetDoesNotMatch",
null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
"doSomethingCollection", new Class[] { List.class }, new Object[] { new ArrayList<>() });
// when - then
this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute);
}
@Test(expected = IllegalArgumentException.class)
public void findFilterTargetNameProvidedArrayUnsupported() throws Exception {
// given
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "param", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
"doSomethingArray", new Class[] { String[].class }, new Object[] { new String[0] });
// when - then
this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute);
}
@Test
public void findFilterTargetNameProvided() throws Exception {
// given
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "param", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
"doSomethingCollection", new Class[] { List.class }, new Object[] { new ArrayList<>() });
// when
boolean result = this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation,
attribute);
// then
assertThat(result).isTrue();
}
@Test(expected = IllegalArgumentException.class)
public void findFilterTargetNameNotProvidedArrayUnsupported() throws Exception {
// given
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
"doSomethingArray", new Class[] { String[].class }, new Object[] { new String[0] });
// when - then
this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute);
}
@Test
public void findFilterTargetNameNotProvided() throws Exception {
// given
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
"doSomethingCollection", new Class[] { List.class }, new Object[] { new ArrayList<>() });
// when
boolean result = this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation,
attribute);
// then
assertThat(result).isTrue();
}
@Test(expected = IllegalArgumentException.class)
public void findFilterTargetNameNotProvidedTypeNotSupported() throws Exception {
// given
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
"doSomethingString", new Class[] { String.class }, new Object[] { "param" });
// when - then
this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute);
}
@Test(expected = IllegalArgumentException.class)
public void findFilterTargetNameNotProvidedMethodAcceptMoreThenOneArgument() throws Exception {
// given
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
"doSomethingTwoArgs", new Class[] { String.class, List.class },
new Object[] { "param", new ArrayList<>() });
// when - then
this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute);
}

View File

@@ -41,15 +41,11 @@ public abstract class AbstractDelegatingSecurityContextExecutorTests
private DelegatingSecurityContextExecutor executor;
// --- constructor ---
@Test(expected = IllegalArgumentException.class)
public void constructorNullDelegate() {
new DelegatingSecurityContextExecutor(null);
}
// --- execute ---
@Test
public void execute() {
this.executor = create();

View File

@@ -78,8 +78,6 @@ public class DelegatingSecurityContextCallableTests {
SecurityContextHolder.clearContext();
}
// --- constructor ---
@Test(expected = IllegalArgumentException.class)
public void constructorNullDelegate() {
new DelegatingSecurityContextCallable<>(null);
@@ -100,8 +98,6 @@ public class DelegatingSecurityContextCallableTests {
new DelegatingSecurityContextCallable<>(this.delegate, null);
}
// --- call ---
@Test
public void call() throws Exception {
this.callable = new DelegatingSecurityContextCallable<>(this.delegate, this.securityContext);
@@ -126,8 +122,6 @@ public class DelegatingSecurityContextCallableTests {
assertWrapped(this.callable.call());
}
// --- create ---
@Test(expected = IllegalArgumentException.class)
public void createNullDelegate() {
DelegatingSecurityContextCallable.create(null, this.securityContext);
@@ -153,8 +147,6 @@ public class DelegatingSecurityContextCallableTests {
assertWrapped(this.callable);
}
// --- toString
// SEC-2682
@Test
public void toStringDelegates() {

View File

@@ -74,8 +74,6 @@ public class DelegatingSecurityContextRunnableTests {
SecurityContextHolder.clearContext();
}
// --- constructor ---
@Test(expected = IllegalArgumentException.class)
public void constructorNullDelegate() {
new DelegatingSecurityContextRunnable(null);
@@ -96,8 +94,6 @@ public class DelegatingSecurityContextRunnableTests {
new DelegatingSecurityContextRunnable(this.delegate, null);
}
// --- run ---
@Test
public void call() throws Exception {
this.runnable = new DelegatingSecurityContextRunnable(this.delegate, this.securityContext);
@@ -123,8 +119,6 @@ public class DelegatingSecurityContextRunnableTests {
assertWrapped(this.runnable);
}
// --- create ---
@Test(expected = IllegalArgumentException.class)
public void createNullDelegate() {
DelegatingSecurityContextRunnable.create(null, this.securityContext);
@@ -150,8 +144,6 @@ public class DelegatingSecurityContextRunnableTests {
assertWrapped(this.runnable);
}
// --- toString
// SEC-2682
@Test
public void toStringDelegates() {