Example #1
0
 @Test(expected = NoSuchDaleqFieldException.class)
 public void getValuesOfField_ifFieldDoesNotExist_sould_fail() {
   final TableData table =
       Daleq.aTable(TheTable.class).withRowsUntil(5).build(new SimpleContext());
   final Iterable<Optional<String>> result = table.getValuesOfField("DOES_NOT_EXIST");
   // should have failed
   assertThat(result, Matchers.nullValue());
 }
Example #2
0
 @Test
 public void getValuesOfField_ifFieldExists_should_returnThoseFields() {
   final TableData table =
       Daleq.aTable(TheTable.class).withRowsUntil(5).build(new SimpleContext());
   final List<Optional<String>> expected =
       Lists.transform(
           Lists.newArrayList("0", "1", "2", "3", "4"),
           new Function<String, Optional<String>>() {
             @Override
             public Optional<String> apply(@Nullable final String input) {
               if (input == null) {
                 return Optional.absent();
               }
               return Optional.of(input);
             }
           });
   assertThat(Lists.newArrayList(table.getValuesOfField("ID")), Matchers.is(expected));
 }