Ejemplo n.º 1
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));
  }
Ejemplo n.º 2
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()));
  }