Пример #1
0
 @Test
 public void detachScopeNotNull() {
   // given
   prepAttach();
   ui.attach();
   ui.setScope(uiScope);
   ui.setInstanceKey(uiKey);
   // when
   ui.detach();
   // then
   verify(uiScope).releaseScope(ui.getInstanceKey());
   verify(broadcaster).unregister(Broadcaster.ALL_MESSAGES, ui);
 }
Пример #2
0
  /** There is a much better functional test */
  @Test
  public void receiveBroadcastMessage() throws Exception {
    // given
    prepAttach();
    ui.attach();
    ui.setScope(uiScope);
    ui.setInstanceKey(uiKey);

    // when
    ui.receiveBroadcast("group", "message", uiKey, 55);
    // then
    assertThat(logMonitor.debugLogs())
        .contains("UI instance UIKey:33 receiving message id: 55 from: UIKey:33");
  }
Пример #3
0
 @Before
 public void setup() {
   Locale.setDefault(Locale.UK);
   when(uiBusProvider.get()).thenReturn(eventBus);
   pushMessageRouter = new DefaultPushMessageRouter(uiBusProvider);
   logMonitor = new LogMonitor();
   logMonitor.addClassFilter(ScopedUI.class);
   uiKey = new UIKey(33);
   ui =
       new BasicUI(
           navigator,
           errorHandler,
           converterFactory,
           broadcaster,
           pushMessageRouter,
           applicationTitle,
           translate,
           currentLocale,
           translator,
           option);
   ui.setInstanceKey(uiKey);
 }