コード例 #1
0
ファイル: TripleTest.java プロジェクト: javafunk/funk
  @Test(expected = NullPointerException.class)
  public void shouldThrowNullPointerExceptionIfNullMapperPassedToMapThird() throws Exception {
    // Given
    Triple<Integer, String, Boolean> triple = tuple(5, "Five", true);
    Mapper<Boolean, String> mapper = null;

    // When
    triple.mapThird(mapper);

    // Then a NullPointerException is thrown
  }
コード例 #2
0
ファイル: TripleTest.java プロジェクト: javafunk/funk
  @Test(expected = NullPointerException.class)
  public void shouldThrowNullPointerExceptionIfNullUnaryFunctionPassedToMapThird()
      throws Exception {
    // Given
    Triple<Integer, String, Boolean> triple = tuple(5, "Five", true);
    UnaryFunction<Boolean, String> function = null;

    // When
    triple.mapThird(function);

    // Then a NullPointerException is thrown
  }
コード例 #3
0
ファイル: TripleTest.java プロジェクト: javafunk/funk
  @Test
  public void shouldBeMappableUsingUnaryFunctionOnThirdPosition() throws Exception {
    // Given
    Triple<Integer, String, Boolean> triple = tuple(5, "Five", true);
    UnaryFunction<Boolean, String> function =
        new UnaryFunction<Boolean, String>() {
          @Override
          public String call(Boolean input) {
            return input.toString();
          }
        };
    Triple<Integer, String, String> expected = tuple(5, "Five", "true");

    // When
    Triple<Integer, String, String> actual = triple.mapThird(function);

    // Then
    assertThat(actual, is(expected));
  }