Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.

This commit is contained in:
Ilkka Seppala
2015-12-25 23:49:28 +02:00
parent 9fbb085985
commit cec9a99410
167 changed files with 1242 additions and 969 deletions

View File

@ -63,6 +63,37 @@ public abstract class EventEmitterTest<E extends EventEmitter> {
testAllDaysWithDefaultObserver(specialDay, event);
}
/**
* Pass each week of the day, day by day to the event emitter and verify of the given observers
* received the correct event on the special day.
*
* @param specialDay The special day on which an event is emitted
* @param event The expected event emitted by the test object
* @param emitter The event emitter
* @param observers The registered observer mocks
*/
private void testAllDays(final Weekday specialDay, final Event event, final E emitter,
final EventObserver... observers) {
for (final Weekday weekday : Weekday.values()) {
// Pass each week of the day, day by day to the event emitter
emitter.timePasses(weekday);
if (weekday == specialDay) {
// On a special day, every observer should have received the event
for (final EventObserver observer : observers) {
verify(observer, times(1)).onEvent(eq(event));
}
} else {
// On any other normal day, the observers should have received nothing at all
verifyZeroInteractions(observers);
}
}
// The observers should not have received any additional events after the week
verifyNoMoreInteractions(observers);
}
/**
* Go over every day of the month, and check if the event is emitted on the given day. Use an
* event emitter without a default observer
@ -99,35 +130,4 @@ public abstract class EventEmitterTest<E extends EventEmitter> {
testAllDays(specialDay, event, emitter, defaultObserver, observer1, observer2);
}
/**
* Pass each week of the day, day by day to the event emitter and verify of the given observers
* received the correct event on the special day.
*
* @param specialDay The special day on which an event is emitted
* @param event The expected event emitted by the test object
* @param emitter The event emitter
* @param observers The registered observer mocks
*/
private void testAllDays(final Weekday specialDay, final Event event, final E emitter,
final EventObserver... observers) {
for (final Weekday weekday : Weekday.values()) {
// Pass each week of the day, day by day to the event emitter
emitter.timePasses(weekday);
if (weekday == specialDay) {
// On a special day, every observer should have received the event
for (final EventObserver observer : observers) {
verify(observer, times(1)).onEvent(eq(event));
}
} else {
// On any other normal day, the observers should have received nothing at all
verifyZeroInteractions(observers);
}
}
// The observers should not have received any additional events after the week
verifyNoMoreInteractions(observers);
}
}

View File

@ -24,7 +24,7 @@ public class KingsHandTest extends EventEmitterTest<KingsHand> {
}
/**
* The {@link KingsHand} is both an {@EventEmitter} as an {@link EventObserver} so verify if every
* The {@link KingsHand} is both an {@link EventEmitter} as an {@link EventObserver} so verify if every
* event received is passed up to it's superior, in most cases {@link KingJoffrey} but now just a
* mocked observer.
*/