コード例 #1
0
  @Test
  public void testOnDocumentSelected() throws Exception {
    DocumentId documentId = new DocumentId(2, "");
    service.onDocumentSelected(new DocumentSelectionEvent(documentId));

    verify(dispatcher).execute(actionCaptor.capture(), resultCaptor.capture());
    GetTransUnitList getTransUnitList = actionCaptor.getValue();
    assertThat(getTransUnitList.getDocumentId(), Matchers.equalTo(documentId));
  }
コード例 #2
0
  @Test
  public void testOnPageSizeChange() throws Exception {
    service.init(initContext);

    service.onPageSizeChange(new EditorPageSizeChangeEvent(5));

    verify(dispatcher, times(2)).execute(actionCaptor.capture(), resultCaptor.capture());
    GetTransUnitList getTransUnitList = actionCaptor.getValue();
    assertThat(getTransUnitList.getCount(), Matchers.equalTo(5));
  }
コード例 #3
0
  @Test
  public void testOnFindMessage() throws Exception {
    service.init(initContext);

    service.onFindMessage(new FindMessageEvent("search"));

    verify(dispatcher, times(2)).execute(actionCaptor.capture(), resultCaptor.capture());
    GetTransUnitList getTransUnitList = actionCaptor.getValue();
    assertThat(getTransUnitList.getPhrase(), Matchers.equalTo("search"));
  }
コード例 #4
0
  @Test
  public void onNavigationEventOnDifferentPage() {
    service.init(initContext);
    service.selectByRowIndex(0);

    service.onNavTransUnit(NavTransUnitEvent.LAST_ENTRY_EVENT);

    verify(dispatcher, times(2)).execute(actionCaptor.capture(), resultCaptor.capture());
    GetTransUnitList action = actionCaptor.getValue();
    assertThat(action.getOffset(), Matchers.equalTo(3));
    assertThat(action.getCount(), Matchers.equalTo(EDITOR_PAGE_SIZE));
    assertThat(action.getTargetTransUnitId(), Matchers.equalTo(data.get(data.size() - 1).getId()));
  }