This commit is contained in:
Stephane Nicoll 2016-04-12 08:34:38 +02:00
parent 454165f4c8
commit 10554a85c9
8 changed files with 54 additions and 54 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -49,7 +49,7 @@ public abstract class AbstractApplicationEventListenerTests {
}
public T getPayload() {
return payload;
return this.payload;
}
}

View File

@ -117,7 +117,7 @@ public class AnnotationDrivenEventListenerTests {
public void metaAnnotationIsDiscovered() {
load(MetaAnnotationListenerTestBean.class);
MetaAnnotationListenerTestBean bean = context.getBean(MetaAnnotationListenerTestBean.class);
MetaAnnotationListenerTestBean bean = this.context.getBean(MetaAnnotationListenerTestBean.class);
this.eventCollector.assertNoEventReceived(bean);
TestEvent event = new TestEvent();
@ -149,9 +149,9 @@ public class AnnotationDrivenEventListenerTests {
failingContext.register(BasicConfiguration.class,
InvalidMethodSignatureEventListener.class);
thrown.expect(BeanInitializationException.class);
thrown.expectMessage(InvalidMethodSignatureEventListener.class.getName());
thrown.expectMessage("cannotBeCalled");
this.thrown.expect(BeanInitializationException.class);
this.thrown.expectMessage(InvalidMethodSignatureEventListener.class.getName());
this.thrown.expectMessage("cannotBeCalled");
failingContext.refresh();
}
@ -341,7 +341,7 @@ public class AnnotationDrivenEventListenerTests {
this.eventCollector.assertNoEventReceived(listener);
this.context.publishEvent(event);
countDownLatch.await(2, TimeUnit.SECONDS);
this.countDownLatch.await(2, TimeUnit.SECONDS);
this.eventCollector.assertEvent(listener, event);
this.eventCollector.assertTotalEventsCount(1);
}
@ -356,7 +356,7 @@ public class AnnotationDrivenEventListenerTests {
this.eventCollector.assertNoEventReceived(listener);
this.context.publishEvent(event);
countDownLatch.await(2, TimeUnit.SECONDS);
this.countDownLatch.await(2, TimeUnit.SECONDS);
this.eventCollector.assertEvent(listener, event);
this.eventCollector.assertTotalEventsCount(1);
}
@ -371,7 +371,7 @@ public class AnnotationDrivenEventListenerTests {
this.eventCollector.assertNoEventReceived(listener);
this.context.publishEvent(event);
countDownLatch.await(2, TimeUnit.SECONDS);
this.countDownLatch.await(2, TimeUnit.SECONDS);
this.eventCollector.assertEvent(listener, event);
this.eventCollector.assertTotalEventsCount(1);
}
@ -401,7 +401,7 @@ public class AnnotationDrivenEventListenerTests {
this.eventCollector.assertNoEventReceived(listener);
this.context.publishEvent(event);
countDownLatch.await(2, TimeUnit.SECONDS);
this.countDownLatch.await(2, TimeUnit.SECONDS);
this.eventCollector.assertEvent(listener, event);
this.eventCollector.assertTotalEventsCount(1);
@ -699,7 +699,7 @@ public class AnnotationDrivenEventListenerTests {
public void handleAsync(AnotherTestEvent event) {
collectEvent(event);
if ("fail".equals(event.content)) {
countDownLatch.countDown();
this.countDownLatch.countDown();
throw new IllegalStateException("Test exception");
}
}
@ -717,7 +717,7 @@ public class AnnotationDrivenEventListenerTests {
public void handleAsync(AnotherTestEvent event) {
assertTrue(!Thread.currentThread().getName().equals(event.content));
collectEvent(event);
countDownLatch.countDown();
this.countDownLatch.countDown();
}
}
@ -756,15 +756,15 @@ public class AnnotationDrivenEventListenerTests {
@EventListener
@Override
public void handleIt(TestEvent event) {
eventCollector.addEvent(this, event);
this.eventCollector.addEvent(this, event);
}
@EventListener
@Async
public void handleAsync(AnotherTestEvent event) {
assertTrue(!Thread.currentThread().getName().equals(event.content));
eventCollector.addEvent(this, event);
countDownLatch.countDown();
this.eventCollector.addEvent(this, event);
this.countDownLatch.countDown();
}
}
@ -782,15 +782,15 @@ public class AnnotationDrivenEventListenerTests {
@EventListener
@Override
public void handleIt(TestEvent event) {
eventCollector.addEvent(this, event);
this.eventCollector.addEvent(this, event);
}
@EventListener
@Async
public void handleAsync(AnotherTestEvent event) {
assertTrue(!Thread.currentThread().getName().equals(event.content));
eventCollector.addEvent(this, event);
countDownLatch.countDown();
this.eventCollector.addEvent(this, event);
this.countDownLatch.countDown();
}
}
@ -811,7 +811,7 @@ public class AnnotationDrivenEventListenerTests {
@Override
public void handleIt(TestEvent event) {
eventCollector.addEvent(this, event);
this.eventCollector.addEvent(this, event);
}
}
@ -914,18 +914,18 @@ public class AnnotationDrivenEventListenerTests {
@EventListener
@Order(50)
public void handleThird(String payload) {
order.add("third");
this.order.add("third");
}
@EventListener
@Order(-50)
public void handleFirst(String payload) {
order.add("first");
this.order.add("first");
}
@EventListener
public void handleSecond(String payload) {
order.add("second");
this.order.add("second");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -452,7 +452,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
@Override
public void onApplicationEvent(MyEvent event) {
assertTrue(otherListener.seenEvents.contains(event));
assertTrue(this.otherListener.seenEvents.contains(event));
}
}
@ -503,7 +503,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
@Override
public void onApplicationEvent(MyEvent event) {
assertTrue(otherListener.seenEvents.contains(event));
assertTrue(this.otherListener.seenEvents.contains(event));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -148,7 +148,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
Method method = ReflectionUtils.findMethod(SampleEvents.class,
"tooManyParameters", String.class, String.class);
thrown.expect(IllegalStateException.class);
this.thrown.expect(IllegalStateException.class);
createTestInstance(method);
}
@ -157,7 +157,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
Method method = ReflectionUtils.findMethod(SampleEvents.class,
"noParameter");
thrown.expect(IllegalStateException.class);
this.thrown.expect(IllegalStateException.class);
createTestInstance(method);
}
@ -166,7 +166,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
Method method = ReflectionUtils.findMethod(SampleEvents.class,
"moreThanOneParameter", String.class, Integer.class);
thrown.expect(IllegalStateException.class);
this.thrown.expect(IllegalStateException.class);
createTestInstance(method);
}
@ -237,9 +237,9 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
"generateRuntimeException", GenericTestEvent.class);
GenericTestEvent<String> event = createGenericTestEvent("fail");
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Test exception");
thrown.expectCause(is(isNull(Throwable.class)));
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Test exception");
this.thrown.expectCause(is(isNull(Throwable.class)));
invokeListener(method, event);
}
@ -249,8 +249,8 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
"generateCheckedException", GenericTestEvent.class);
GenericTestEvent<String> event = createGenericTestEvent("fail");
thrown.expect(UndeclaredThrowableException.class);
thrown.expectCause(is(instanceOf(IOException.class)));
this.thrown.expect(UndeclaredThrowableException.class);
this.thrown.expectCause(is(instanceOf(IOException.class)));
invokeListener(method, event);
}
@ -265,8 +265,8 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
Method method = ReflectionUtils.findMethod(InvalidProxyTestBean.class, "handleIt2", ApplicationEvent.class);
StaticApplicationListenerMethodAdapter listener =
new StaticApplicationListenerMethodAdapter(method, bean);
thrown.expect(IllegalStateException.class);
thrown.expectMessage("handleIt2");
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("handleIt2");
listener.onApplicationEvent(createGenericTestEvent("test"));
}
@ -373,7 +373,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
@Override
public Object getTargetBean() {
return targetBean;
return this.targetBean;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -46,20 +46,20 @@ public class EventPublicationInterceptorTests {
@Before
public void setUp() {
publisher = mock(ApplicationEventPublisher.class);
this.publisher = mock(ApplicationEventPublisher.class);
}
@Test(expected=IllegalArgumentException.class)
public void testWithNoApplicationEventClassSupplied() throws Exception {
EventPublicationInterceptor interceptor = new EventPublicationInterceptor();
interceptor.setApplicationEventPublisher(publisher);
interceptor.setApplicationEventPublisher(this.publisher);
interceptor.afterPropertiesSet();
}
@Test(expected=IllegalArgumentException.class)
public void testWithNonApplicationEventClassSupplied() throws Exception {
EventPublicationInterceptor interceptor = new EventPublicationInterceptor();
interceptor.setApplicationEventPublisher(publisher);
interceptor.setApplicationEventPublisher(this.publisher);
interceptor.setApplicationEventClass(getClass());
interceptor.afterPropertiesSet();
}
@ -67,7 +67,7 @@ public class EventPublicationInterceptorTests {
@Test(expected=IllegalArgumentException.class)
public void testWithAbstractStraightApplicationEventClassSupplied() throws Exception {
EventPublicationInterceptor interceptor = new EventPublicationInterceptor();
interceptor.setApplicationEventPublisher(publisher);
interceptor.setApplicationEventPublisher(this.publisher);
interceptor.setApplicationEventClass(ApplicationEvent.class);
interceptor.afterPropertiesSet();
}
@ -75,7 +75,7 @@ public class EventPublicationInterceptorTests {
@Test(expected=IllegalArgumentException.class)
public void testWithApplicationEventClassThatDoesntExposeAValidCtor() throws Exception {
EventPublicationInterceptor interceptor = new EventPublicationInterceptor();
interceptor.setApplicationEventPublisher(publisher);
interceptor.setApplicationEventPublisher(this.publisher);
interceptor.setApplicationEventClass(TestEventWithNoValidOneArgObjectCtor.class);
interceptor.afterPropertiesSet();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -31,7 +31,7 @@ public abstract class AbstractIdentifiable implements Identifiable {
@Override
public String getId() {
return id;
return this.id;
}
@Override
@ -41,12 +41,12 @@ public abstract class AbstractIdentifiable implements Identifiable {
AbstractIdentifiable that = (AbstractIdentifiable) o;
return id.equals(that.id);
return this.id.equals(that.id);
}
@Override
public int hashCode() {
return id.hashCode();
return this.id.hashCode();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -56,7 +56,7 @@ public class EventCollector {
* Assert that the listener identified by the specified id has not received any event.
*/
public void assertNoEventReceived(String listenerId) {
List<Object> events = content.getOrDefault(listenerId, Collections.emptyList());
List<Object> events = this.content.getOrDefault(listenerId, Collections.emptyList());
assertEquals("Expected no events but got " + events, 0, events.size());
}
@ -72,7 +72,7 @@ public class EventCollector {
* specified events, in that specific order.
*/
public void assertEvent(String listenerId, Object... events) {
List<Object> actual = content.getOrDefault(listenerId, Collections.emptyList());
List<Object> actual = this.content.getOrDefault(listenerId, Collections.emptyList());
assertEquals("wrong number of events", events.length, actual.size());
for (int i = 0; i < events.length; i++) {
assertEquals("Wrong event at index " + i, events[i], actual.get(i));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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,7 +45,7 @@ public abstract class IdentifiableApplicationEvent extends ApplicationEvent impl
@Override
public String getId() {
return id;
return this.id;
}
@Override
@ -55,13 +55,13 @@ public abstract class IdentifiableApplicationEvent extends ApplicationEvent impl
IdentifiableApplicationEvent that = (IdentifiableApplicationEvent) o;
return id.equals(that.id);
return this.id.equals(that.id);
}
@Override
public int hashCode() {
return id.hashCode();
return this.id.hashCode();
}
}