コード例 #1
0
  @Test
  public void shouldReturnTransformedTableOnExecute() throws Exception {
    Table expected = createTable();
    when(tableGigaSpace.read(new Table())).thenReturn(expected);

    TableSummary tableSummary = underTest.execute();

    assertEquals(expected.summarise(gameRules), tableSummary);
  }
コード例 #2
0
  @Test
  public void shouldReturnMergedResults() throws Exception {
    final Table aTable = createTable();
    List<AsyncResult<TableSummary>> taskResults = new ArrayList<AsyncResult<TableSummary>>();
    final TableSummary expected = aTable.summarise(gameRules);
    taskResults.add(
        new AsyncResult<TableSummary>() {
          @Override
          public TableSummary getResult() {
            return expected;
          }

          @Override
          public Exception getException() {
            return null;
          }
        });
    TableSummary result = underTest.reduce(taskResults);

    assertEquals(expected, result);
  }