mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 17:26:22 +01:00
added modules, classloading and view packages to sonia.scm.lifecycle
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package sonia.scm.lifecycle.modules;
|
||||
|
||||
import com.github.legman.Subscribe;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import sonia.scm.event.LegmanScmEventBus;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class ScmEventBusModuleTest {
|
||||
|
||||
@Test
|
||||
void shouldRegisterInstance() {
|
||||
LegmanScmEventBus eventBus = new LegmanScmEventBus();
|
||||
|
||||
Injector injector = Guice.createInjector(new ScmEventBusModule(eventBus));
|
||||
Listener listener = injector.getInstance(Listener.class);
|
||||
|
||||
eventBus.post("hello");
|
||||
|
||||
assertThat(listener.message).isEqualTo("hello");
|
||||
}
|
||||
|
||||
public static class Listener {
|
||||
|
||||
private String message;
|
||||
|
||||
@Subscribe(async = false)
|
||||
public void receive(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user