Skip to content

Commit 1fd6248

Browse files
committed
Polishing
1 parent c037e75 commit 1fd6248

23 files changed

+97
-102
lines changed

spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,29 +30,28 @@ public class PropertiesBeanDefinitionReaderTests {
3030

3131
private final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
3232

33-
private final PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(
34-
beanFactory);
33+
private final PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(this.beanFactory);
3534

3635

3736
@Test
3837
public void withSimpleConstructorArg() {
3938
this.reader.loadBeanDefinitions(new ClassPathResource("simpleConstructorArg.properties", getClass()));
40-
TestBean bean = (TestBean)this.beanFactory.getBean("testBean");
39+
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
4140
assertEquals("Rob Harrop", bean.getName());
4241
}
4342

4443
@Test
45-
public void withConstructorArgRef() throws Exception {
44+
public void withConstructorArgRef() {
4645
this.reader.loadBeanDefinitions(new ClassPathResource("refConstructorArg.properties", getClass()));
47-
TestBean rob = (TestBean)this.beanFactory.getBean("rob");
48-
TestBean sally = (TestBean)this.beanFactory.getBean("sally");
46+
TestBean rob = (TestBean) this.beanFactory.getBean("rob");
47+
TestBean sally = (TestBean) this.beanFactory.getBean("sally");
4948
assertEquals(sally, rob.getSpouse());
5049
}
5150

5251
@Test
53-
public void withMultipleConstructorsArgs() throws Exception {
52+
public void withMultipleConstructorsArgs() {
5453
this.reader.loadBeanDefinitions(new ClassPathResource("multiConstructorArgs.properties", getClass()));
55-
TestBean bean = (TestBean)this.beanFactory.getBean("testBean");
54+
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
5655
assertEquals("Rob Harrop", bean.getName());
5756
assertEquals(23, bean.getAge());
5857
}

spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ public class AfterAdviceBindingTests {
4444

4545
private TestBean testBeanTarget;
4646

47+
4748
@Before
48-
public void setUp() throws Exception {
49+
public void setup() throws Exception {
4950
ClassPathXmlApplicationContext ctx =
50-
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
51+
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
5152
AdviceBindingTestAspect afterAdviceAspect = (AdviceBindingTestAspect) ctx.getBean("testAspect");
5253

5354
testBeanProxy = (ITestBean) ctx.getBean("testBean");
@@ -60,6 +61,7 @@ public void setUp() throws Exception {
6061
afterAdviceAspect.setCollaborator(mockCollaborator);
6162
}
6263

64+
6365
@Test
6466
public void testOneIntArg() {
6567
testBeanProxy.setAge(5);

spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,14 +48,10 @@ public class AfterReturningAdviceBindingTests {
4848
private AfterReturningAdviceBindingCollaborator mockCollaborator;
4949

5050

51-
public void setAfterReturningAdviceAspect(AfterReturningAdviceBindingTestAspect anAspect) {
52-
this.afterAdviceAspect = anAspect;
53-
}
54-
5551
@Before
56-
public void setUp() throws Exception {
52+
public void setup() throws Exception {
5753
ClassPathXmlApplicationContext ctx =
58-
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
54+
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
5955

6056
afterAdviceAspect = (AfterReturningAdviceBindingTestAspect) ctx.getBean("testAspect");
6157

spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,10 +39,11 @@ public class AfterThrowingAdviceBindingTests {
3939

4040
private AfterThrowingAdviceBindingCollaborator mockCollaborator;
4141

42+
4243
@Before
43-
public void setUp() {
44+
public void setup() {
4445
ClassPathXmlApplicationContext ctx =
45-
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
46+
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
4647

4748
testBean = (ITestBean) ctx.getBean("testBean");
4849
afterThrowingAdviceAspect = (AfterThrowingAdviceBindingTestAspect) ctx.getBean("testAspect");
@@ -51,6 +52,7 @@ public void setUp() {
5152
afterThrowingAdviceAspect.setCollaborator(mockCollaborator);
5253
}
5354

55+
5456
@Test(expected = Throwable.class)
5557
public void testSimpleAfterThrowing() throws Throwable {
5658
this.testBean.exceptional(new Throwable());
@@ -132,5 +134,4 @@ public void noArgsOnThrowableMatch() {
132134
public void noArgsOnRuntimeExceptionMatch() {
133135
this.collaborator.noArgsOnRuntimeExceptionMatch();
134136
}
135-
136137
}

spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,16 @@ public class AspectAndAdvicePrecedenceTests {
4949

5050

5151
@Before
52-
public void setUp() {
52+
public void setup() {
5353
ClassPathXmlApplicationContext ctx =
54-
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
54+
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
5555
highPrecedenceAspect = (PrecedenceTestAspect) ctx.getBean("highPrecedenceAspect");
5656
lowPrecedenceAspect = (PrecedenceTestAspect) ctx.getBean("lowPrecedenceAspect");
5757
highPrecedenceSpringAdvice = (SimpleSpringBeforeAdvice) ctx.getBean("highPrecedenceSpringAdvice");
5858
lowPrecedenceSpringAdvice = (SimpleSpringBeforeAdvice) ctx.getBean("lowPrecedenceSpringAdvice");
5959
testBean = (ITestBean) ctx.getBean("testBean");
6060
}
6161

62-
// ========== end of test case set up, start of tests proper ===================
6362

6463
@Test
6564
public void testAdviceOrder() {

spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ public class AspectJExpressionPointcutAdvisorTests {
3737

3838
private CallCountingInterceptor interceptor;
3939

40+
4041
@Before
41-
public void setUp() {
42+
public void setup() {
4243
ClassPathXmlApplicationContext ctx =
43-
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
44+
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
4445
testBean = (ITestBean) ctx.getBean("testBean");
4546
interceptor = (CallCountingInterceptor) ctx.getBean("interceptor");
4647
}
4748

49+
4850
@Test
4951
public void testPointcutting() {
5052
assertEquals("Count should be 0", 0, interceptor.getCount());

spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -45,8 +45,7 @@ public class BeanNamePointcutAtAspectTests {
4545

4646

4747
@org.junit.Before
48-
@SuppressWarnings("resource")
49-
public void setUp() {
48+
public void setup() {
5049
ClassPathXmlApplicationContext ctx =
5150
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
5251

@@ -55,6 +54,7 @@ public void setUp() {
5554
testBean3 = (ITestBean) ctx.getBean("testBean3");
5655
}
5756

57+
5858
@Test
5959
public void testMatchingBeanName() {
6060
assertTrue("Expected a proxy", testBean1 instanceof Advised);

spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ public class BeanNamePointcutTests {
5555

5656

5757
@Before
58-
public void setUp() {
58+
public void setup() {
5959
ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
6060
testBean1 = (ITestBean) ctx.getBean("testBean1");
6161
testBean2 = (ITestBean) ctx.getBean("testBean2");

spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,14 +44,11 @@ public class BeforeAdviceBindingTests {
4444

4545
private TestBean testBeanTarget;
4646

47-
protected String getConfigPath() {
48-
return "before-advice-tests.xml";
49-
}
5047

5148
@Before
52-
public void setUp() throws Exception {
49+
public void setup() throws Exception {
5350
ClassPathXmlApplicationContext ctx =
54-
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
51+
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
5552

5653
testBeanProxy = (ITestBean) ctx.getBean("testBean");
5754
assertTrue(AopUtils.isAopProxy(testBeanProxy));

spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,14 +39,14 @@ public class DeclarationOrderIndependenceTests {
3939

4040

4141
@Before
42-
@SuppressWarnings("resource")
43-
public void setUp() {
42+
public void setup() {
4443
ClassPathXmlApplicationContext ctx =
45-
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
44+
new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
4645
aspect = (TopsyTurvyAspect) ctx.getBean("topsyTurvyAspect");
4746
target = (TopsyTurvyTarget) ctx.getBean("topsyTurvyTarget");
4847
}
4948

49+
5050
@Test
5151
public void testTargetIsSerializable() {
5252
assertTrue("target bean is serializable",this.target instanceof Serializable);
@@ -135,10 +135,9 @@ public Object around(ProceedingJoinPoint pjp) throws Throwable {
135135

136136
interface TopsyTurvyTarget {
137137

138-
public abstract void doSomething();
139-
140-
public abstract int getX();
138+
void doSomething();
141139

140+
int getX();
142141
}
143142

144143

@@ -155,7 +154,6 @@ public void doSomething() {
155154
public int getX() {
156155
return x;
157156
}
158-
159157
}
160158

161159

@@ -179,5 +177,4 @@ public void aroundAdviceFired() {
179177
public void beforeAdviceFired() {
180178
this.beforeFired = true;
181179
}
182-
183180
}

0 commit comments

Comments
 (0)