Polishing

(cherry picked from commit 1fd6248d84)
This commit is contained in:
Juergen Hoeller
2018-07-27 17:46:21 +02:00
parent 5f96d7c46c
commit 6839570187
27 changed files with 116 additions and 114 deletions

View File

@@ -822,12 +822,16 @@ class CglibAopProxy implements AopProxy, Serializable {
}
// We must always proxy equals, to direct calls to this.
if (AopUtils.isEqualsMethod(method)) {
logger.debug("Found 'equals' method: " + method);
if (logger.isDebugEnabled()) {
logger.debug("Found 'equals' method: " + method);
}
return INVOKE_EQUALS;
}
// We must always calculate hashCode based on the proxy.
if (AopUtils.isHashCodeMethod(method)) {
logger.debug("Found 'hashCode' method: " + method);
if (logger.isDebugEnabled()) {
logger.debug("Found 'hashCode' method: " + method);
}
return INVOKE_HASHCODE;
}
Class<?> targetClass = this.advised.getTargetClass();

View File

@@ -156,6 +156,9 @@ public class DefaultNamespaceHandlerResolver implements NamespaceHandlerResolver
synchronized (this) {
handlerMappings = this.handlerMappings;
if (handlerMappings == null) {
if (logger.isDebugEnabled()) {
logger.debug("Loading NamespaceHandler mappings from [" + this.handlerMappingsLocation + "]");
}
try {
Properties mappings =
PropertiesLoaderUtils.loadAllProperties(this.handlerMappingsLocation, this.classLoader);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -126,7 +126,7 @@ public class PluggableSchemaResolver implements EntityResolver {
}
catch (FileNotFoundException ex) {
if (logger.isDebugEnabled()) {
logger.debug("Couldn't find XML schema [" + systemId + "]: " + resource, ex);
logger.debug("Could not find XML schema [" + systemId + "]: " + resource, ex);
}
}
}

View File

@@ -105,7 +105,8 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
private boolean namespaceAware = false;
private Class<?> documentReaderClass = DefaultBeanDefinitionDocumentReader.class;
private Class<? extends BeanDefinitionDocumentReader> documentReaderClass =
DefaultBeanDefinitionDocumentReader.class;
private ProblemReporter problemReporter = new FailFastProblemReporter();
@@ -313,7 +314,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException {
Assert.notNull(encodedResource, "EncodedResource must not be null");
if (logger.isInfoEnabled()) {
logger.info("Loading XML bean definitions from " + encodedResource.getResource());
logger.info("Loading XML bean definitions from " + encodedResource);
}
Set<EncodedResource> currentResources = this.resourcesCurrentlyBeingLoaded.get();
@@ -429,9 +430,8 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
getValidationModeForResource(resource), isNamespaceAware());
}
/**
* Gets the validation mode for the specified {@link Resource}. If no explicit
* Get the validation mode for the specified {@link Resource}. If no explicit
* validation mode has been configured then the validation mode is
* {@link #detectValidationMode detected}.
* <p>Override this method if you would like full control over the validation
@@ -453,7 +453,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
}
/**
* Detects which kind of validation to perform on the XML file identified
* Detect which kind of validation to perform on the XML file identified
* by the supplied {@link Resource}. If the file has a {@code DOCTYPE}
* definition then DTD validation is used otherwise XSD validation is assumed.
* <p>Override this method if you would like to customize resolution
@@ -515,7 +515,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
* @see #setDocumentReaderClass
*/
protected BeanDefinitionDocumentReader createBeanDefinitionDocumentReader() {
return BeanDefinitionDocumentReader.class.cast(BeanUtils.instantiateClass(this.documentReaderClass));
return BeanUtils.instantiateClass(this.documentReaderClass);
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,29 +30,28 @@ public class PropertiesBeanDefinitionReaderTests {
private final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
private final PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(
beanFactory);
private final PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(this.beanFactory);
@Test
public void withSimpleConstructorArg() {
this.reader.loadBeanDefinitions(new ClassPathResource("simpleConstructorArg.properties", getClass()));
TestBean bean = (TestBean)this.beanFactory.getBean("testBean");
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
assertEquals("Rob Harrop", bean.getName());
}
@Test
public void withConstructorArgRef() throws Exception {
public void withConstructorArgRef() {
this.reader.loadBeanDefinitions(new ClassPathResource("refConstructorArg.properties", getClass()));
TestBean rob = (TestBean)this.beanFactory.getBean("rob");
TestBean sally = (TestBean)this.beanFactory.getBean("sally");
TestBean rob = (TestBean) this.beanFactory.getBean("rob");
TestBean sally = (TestBean) this.beanFactory.getBean("sally");
assertEquals(sally, rob.getSpouse());
}
@Test
public void withMultipleConstructorsArgs() throws Exception {
public void withMultipleConstructorsArgs() {
this.reader.loadBeanDefinitions(new ClassPathResource("multiConstructorArgs.properties", getClass()));
TestBean bean = (TestBean)this.beanFactory.getBean("testBean");
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
assertEquals("Rob Harrop", bean.getName());
assertEquals(23, bean.getAge());
}

View File

@@ -44,10 +44,11 @@ public class AfterAdviceBindingTests {
private TestBean testBeanTarget;
@Before
public void setUp() throws Exception {
public void setup() throws Exception {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
AdviceBindingTestAspect afterAdviceAspect = (AdviceBindingTestAspect) ctx.getBean("testAspect");
testBeanProxy = (ITestBean) ctx.getBean("testBean");
@@ -60,6 +61,7 @@ public class AfterAdviceBindingTests {
afterAdviceAspect.setCollaborator(mockCollaborator);
}
@Test
public void testOneIntArg() {
testBeanProxy.setAge(5);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,14 +48,10 @@ public class AfterReturningAdviceBindingTests {
private AfterReturningAdviceBindingCollaborator mockCollaborator;
public void setAfterReturningAdviceAspect(AfterReturningAdviceBindingTestAspect anAspect) {
this.afterAdviceAspect = anAspect;
}
@Before
public void setUp() throws Exception {
public void setup() throws Exception {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
afterAdviceAspect = (AfterReturningAdviceBindingTestAspect) ctx.getBean("testAspect");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,10 +39,11 @@ public class AfterThrowingAdviceBindingTests {
private AfterThrowingAdviceBindingCollaborator mockCollaborator;
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testBean = (ITestBean) ctx.getBean("testBean");
afterThrowingAdviceAspect = (AfterThrowingAdviceBindingTestAspect) ctx.getBean("testAspect");
@@ -51,6 +52,7 @@ public class AfterThrowingAdviceBindingTests {
afterThrowingAdviceAspect.setCollaborator(mockCollaborator);
}
@Test(expected = Throwable.class)
public void testSimpleAfterThrowing() throws Throwable {
this.testBean.exceptional(new Throwable());
@@ -132,5 +134,4 @@ final class AfterThrowingAdviceBindingTestAspect {
public void noArgsOnRuntimeExceptionMatch() {
this.collaborator.noArgsOnRuntimeExceptionMatch();
}
}

View File

@@ -49,9 +49,9 @@ public class AspectAndAdvicePrecedenceTests {
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
highPrecedenceAspect = (PrecedenceTestAspect) ctx.getBean("highPrecedenceAspect");
lowPrecedenceAspect = (PrecedenceTestAspect) ctx.getBean("lowPrecedenceAspect");
highPrecedenceSpringAdvice = (SimpleSpringBeforeAdvice) ctx.getBean("highPrecedenceSpringAdvice");
@@ -59,7 +59,6 @@ public class AspectAndAdvicePrecedenceTests {
testBean = (ITestBean) ctx.getBean("testBean");
}
// ========== end of test case set up, start of tests proper ===================
@Test
public void testAdviceOrder() {

View File

@@ -37,14 +37,16 @@ public class AspectJExpressionPointcutAdvisorTests {
private CallCountingInterceptor interceptor;
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testBean = (ITestBean) ctx.getBean("testBean");
interceptor = (CallCountingInterceptor) ctx.getBean("interceptor");
}
@Test
public void testPointcutting() {
assertEquals("Count should be 0", 0, interceptor.getCount());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,8 +45,7 @@ public class BeanNamePointcutAtAspectTests {
@org.junit.Before
@SuppressWarnings("resource")
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
@@ -55,6 +54,7 @@ public class BeanNamePointcutAtAspectTests {
testBean3 = (ITestBean) ctx.getBean("testBean3");
}
@Test
public void testMatchingBeanName() {
assertTrue("Expected a proxy", testBean1 instanceof Advised);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ public class BeanNamePointcutTests {
@Before
public void setUp() {
public void setup() {
ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testBean1 = (ITestBean) ctx.getBean("testBean1");
testBean2 = (ITestBean) ctx.getBean("testBean2");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,14 +44,11 @@ public class BeforeAdviceBindingTests {
private TestBean testBeanTarget;
protected String getConfigPath() {
return "before-advice-tests.xml";
}
@Before
public void setUp() throws Exception {
public void setup() throws Exception {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testBeanProxy = (ITestBean) ctx.getBean("testBean");
assertTrue(AopUtils.isAopProxy(testBeanProxy));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,14 +39,14 @@ public class DeclarationOrderIndependenceTests {
@Before
@SuppressWarnings("resource")
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
aspect = (TopsyTurvyAspect) ctx.getBean("topsyTurvyAspect");
target = (TopsyTurvyTarget) ctx.getBean("topsyTurvyTarget");
}
@Test
public void testTargetIsSerializable() {
assertTrue("target bean is serializable",this.target instanceof Serializable);
@@ -135,10 +135,9 @@ class TopsyTurvyAspect {
interface TopsyTurvyTarget {
public abstract void doSomething();
public abstract int getX();
void doSomething();
int getX();
}
@@ -155,7 +154,6 @@ class TopsyTurvyTargetImpl implements TopsyTurvyTarget {
public int getX() {
return x;
}
}
@@ -179,5 +177,4 @@ class AspectCollaborator implements TopsyTurvyAspect.Collaborator {
public void beforeAdviceFired() {
this.beforeFired = true;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,14 +35,15 @@ public class DeclareParentsDelegateRefTests {
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
noMethodsBean = (NoMethodsBean) ctx.getBean("noMethodsBean");
counter = (Counter) ctx.getBean("counter");
counter.reset();
}
@Test
public void testIntroductionWasMade() {
assertTrue("Introduction must have been made", noMethodsBean instanceof ICounter);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +21,7 @@ import org.junit.Test;
import test.mixin.Lockable;
import org.springframework.aop.support.AopUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
import org.springframework.tests.sample.beans.ITestBean;
import static org.junit.Assert.*;
@@ -37,18 +34,22 @@ public class DeclareParentsTests {
private ITestBean testBeanProxy;
private ApplicationContext ctx;
private Object introductionObject;
@Before
public void setUp() throws Exception {
ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testBeanProxy = (ITestBean) ctx.getBean("testBean");
assertTrue(AopUtils.isAopProxy(testBeanProxy));
introductionObject = ctx.getBean("introduction");
}
@Test
public void testIntroductionWasMade() {
assertTrue(AopUtils.isAopProxy(testBeanProxy));
assertFalse("Introduction should not be proxied", AopUtils.isAopProxy(introductionObject));
assertTrue("Introduction must have been made", testBeanProxy instanceof Lockable);
}
@@ -58,11 +59,6 @@ public class DeclareParentsTests {
// on the introduction, in which case this would not be a problem.
@Test
public void testLockingWorks() {
Assume.group(TestGroup.LONG_RUNNING);
Object introductionObject = ctx.getBean("introduction");
assertFalse("Introduction should not be proxied", AopUtils.isAopProxy(introductionObject));
Lockable lockable = (Lockable) testBeanProxy;
assertFalse(lockable.locked());
@@ -90,5 +86,4 @@ class NonAnnotatedMakeLockable {
throw new IllegalStateException("locked");
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,14 +43,15 @@ public class ProceedTests {
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testBean = (SimpleBean) ctx.getBean("testBean");
firstTestAspect = (ProceedTestingAspect) ctx.getBean("firstTestAspect");
secondTestAspect = (ProceedTestingAspect) ctx.getBean("secondTestAspect");
}
@Test
public void testSimpleProceedWithChangedArgs() {
this.testBean.setName("abc");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,18 +33,18 @@ public class SharedPointcutWithArgsMismatchTests {
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
toBeAdvised = (ToBeAdvised) ctx.getBean("toBeAdvised");
}
@Test
public void testMismatchedArgBinding() {
this.toBeAdvised.foo("Hello");
}
}
@@ -66,4 +66,3 @@ class MyAspect {
System.out.println(x);
}
}

View File

@@ -40,14 +40,15 @@ public class SubtypeSensitiveMatchingTests {
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
nonSerializableBean = (NonSerializableFoo) ctx.getBean("testClassA");
serializableBean = (SerializableFoo) ctx.getBean("testClassB");
bar = (Bar) ctx.getBean("testClassC");
}
@Test
public void testBeansAreProxiedOnStaticMatch() {
assertTrue("bean with serializable type should be proxied",
@@ -68,11 +69,15 @@ public class SubtypeSensitiveMatchingTests {
}
//strange looking interfaces are just to set up certain test conditions...
interface NonSerializableFoo { void foo(); }
interface SerializableFoo extends Serializable { void foo(); }
class SubtypeMatchingTestClassA implements NonSerializableFoo {
@Override
@@ -80,6 +85,7 @@ class SubtypeMatchingTestClassA implements NonSerializableFoo {
}
@SuppressWarnings("serial")
class SubtypeMatchingTestClassB implements SerializableFoo {
@@ -88,8 +94,10 @@ class SubtypeMatchingTestClassB implements SerializableFoo {
}
interface Bar { void bar(Object o); }
class SubtypeMatchingTestClassC implements Bar {
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package org.springframework.aop.aspectj;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Before;
import org.junit.Test;
@@ -47,11 +46,9 @@ public class TargetPointcutSelectionTests {
@Before
@SuppressWarnings("resource")
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testImpl1 = (TestInterface) ctx.getBean("testImpl1");
testImpl2 = (TestInterface) ctx.getBean("testImpl2");
testAspectForTestImpl1 = (TestAspect) ctx.getBean("testAspectForTestImpl1");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import java.lang.annotation.RetentionPolicy;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import static org.junit.Assert.*;
@@ -40,11 +41,11 @@ public class ThisAndTargetSelectionOnlyPointcutsAtAspectJTests {
private Counter counter;
@org.junit.Before
@SuppressWarnings("resource")
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testBean = (TestInterface) ctx.getBean("testBean");
testAnnotatedClassBean = (TestInterface) ctx.getBean("testAnnotatedClassBean");
testAnnotatedMethodBean = (TestInterface) ctx.getBean("testAnnotatedMethodBean");
@@ -52,6 +53,7 @@ public class ThisAndTargetSelectionOnlyPointcutsAtAspectJTests {
counter.reset();
}
@Test
public void thisAsClassDoesNotMatch() {
testBean.doIt();

View File

@@ -39,18 +39,16 @@ public class ThisAndTargetSelectionOnlyPointcutsTests {
private Counter thisAsInterfaceAndTargetAsInterfaceCounter;
private Counter thisAsInterfaceAndTargetAsClassCounter;
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
testBean = (TestInterface) ctx.getBean("testBean");
thisAsClassCounter = (Counter) ctx.getBean("thisAsClassCounter");
thisAsInterfaceCounter = (Counter) ctx.getBean("thisAsInterfaceCounter");
targetAsClassCounter = (Counter) ctx.getBean("targetAsClassCounter");
targetAsInterfaceCounter = (Counter) ctx.getBean("targetAsInterfaceCounter");
thisAsClassAndTargetAsClassCounter = (Counter) ctx.getBean("thisAsClassAndTargetAsClassCounter");
thisAsInterfaceAndTargetAsInterfaceCounter = (Counter) ctx.getBean("thisAsInterfaceAndTargetAsInterfaceCounter");
thisAsInterfaceAndTargetAsClassCounter = (Counter) ctx.getBean("thisAsInterfaceAndTargetAsClassCounter");
@@ -59,12 +57,12 @@ public class ThisAndTargetSelectionOnlyPointcutsTests {
thisAsInterfaceCounter.reset();
targetAsClassCounter.reset();
targetAsInterfaceCounter.reset();
thisAsClassAndTargetAsClassCounter.reset();
thisAsInterfaceAndTargetAsInterfaceCounter.reset();
thisAsInterfaceAndTargetAsClassCounter.reset();
}
@Test
public void testThisAsClassDoesNotMatch() {
testBean.doIt();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ public class AnnotationBindingTests {
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
testBean = (AnnotatedTestBean) ctx.getBean("testBean");

View File

@@ -40,7 +40,7 @@ public class AtAspectJAnnotationBindingTests {
@Before
public void setUp() {
public void setup() {
ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
testBean = (AnnotatedTestBean) ctx.getBean("testBean");
}
@@ -84,7 +84,7 @@ class ResourceArrayFactoryBean implements FactoryBean<Object> {
@Override
@TestAnnotation("some value")
public Object getObject() throws Exception {
public Object getObject() {
return new Resource[0];
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,9 +48,9 @@ public class AfterReturningGenericTypeMatchingTests {
@Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
counterAspect = (CounterAspect) ctx.getBean("counterAspect");
counterAspect.reset();
@@ -58,6 +58,7 @@ public class AfterReturningGenericTypeMatchingTests {
testBean = (GenericReturnTypeVariationClass) ctx.getBean("testBean");
}
@Test
public void testReturnTypeExactMatching() {
testBean.getStrings();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,9 +48,9 @@ public class GenericBridgeMethodMatchingTests {
@SuppressWarnings("unchecked")
@org.junit.Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
counterAspect = (GenericCounterAspect) ctx.getBean("counterAspect");
counterAspect.count = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,9 +43,9 @@ public class GenericParameterMatchingTests {
@SuppressWarnings("unchecked")
@org.junit.Before
public void setUp() {
public void setup() {
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
counterAspect = (CounterAspect) ctx.getBean("counterAspect");
counterAspect.reset();