Created
June 16, 2016 09:34
-
-
Save kronar/4614b636ec5c379f1cd5df2a6fed1ec4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package internal; | |
import com.google.common.eventbus.EventBus; | |
import com.google.common.eventbus.Subscribe; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import org.junit.Assert; | |
import org.junit.Test; | |
/** | |
* Created by nikita on 16.06.16. | |
*/ | |
public class TetsEBHandlersIdentity { | |
private static final class HandlerOne { | |
public static AtomicInteger counter = new AtomicInteger(); | |
@Subscribe | |
public void onInteger(Integer value) { | |
counter.incrementAndGet(); | |
} | |
} | |
@Test | |
public void test() { | |
EventBus eb = new EventBus(); | |
eb.register(new HandlerOne()); | |
eb.register(new HandlerOne()); | |
eb.post(new Integer(100)); | |
//Fucking bug in Guava event bus | |
Assert.assertEquals(HandlerOne.counter.intValue(), 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment