http://gwt-code-reviews.appspot.com/1526803/diff/3/user/src/com/google/web/bindery/event/shared/testing/CountingEventBus.java
File
user/src/com/google/web/bindery/event/shared/testing/CountingEventBus.java
(right):

http://gwt-code-reviews.appspot.com/1526803/diff/3/user/src/com/google/web/bindery/event/shared/testing/CountingEventBus.java#newcode47
user/src/com/google/web/bindery/event/shared/testing/CountingEventBus.java:47:
handlerCounts.increment(type);
I still think we should increment last since that's more likely to catch
failures. Any tests depending on the count being "wrong" (if there are
any) should be fixed.

http://gwt-code-reviews.appspot.com/1526803/diff/3/user/test/com/google/web/bindery/event/shared/testing/CountingEventBusTest.java
File
user/test/com/google/web/bindery/event/shared/testing/CountingEventBusTest.java
(right):

http://gwt-code-reviews.appspot.com/1526803/diff/3/user/test/com/google/web/bindery/event/shared/testing/CountingEventBusTest.java#newcode40
user/test/com/google/web/bindery/event/shared/testing/CountingEventBusTest.java:40:
assertEquals(1, eventBus.getHandlerCount(FooEvent.TYPE));
These numbers should always be the same, so to cut down on verbosity,
could you extract a two-line helper method to check both counts?

http://gwt-code-reviews.appspot.com/1526803/diff/3/user/test/com/google/web/bindery/event/shared/testing/CountingEventBusTest.java#newcode102
user/test/com/google/web/bindery/event/shared/testing/CountingEventBusTest.java:102:
assertEquals(0, eventBus.getFiredCountFromSource(FooEvent.TYPE,
source1));
perhaps extract "checkSourceEvents()" method to cut down on repetition.

http://gwt-code-reviews.appspot.com/1526803/diff/3/user/test/com/google/web/bindery/event/shared/testing/CountingEventBusTest.java#newcode144
user/test/com/google/web/bindery/event/shared/testing/CountingEventBusTest.java:144:
private void assertTotalEventsFired_NoSource(Type<?> type, int fired) {
Perhaps rename to something shorter like "checkTotalEvents".

Also, I usually put the expected value first to match assertEquals().

http://gwt-code-reviews.appspot.com/1526803/

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to