public class FunctionsTests {
@Test
public void Functions_converter_example() {
Function stringToInteger = new Function() {
@Override
public Integer apply(String input) {
return Integer.valueOf(input);
}
};
Function integerToLong = new Function\() {
@Override
public Long apply(Integer input) {
return Long.valueOf(input.longValue());
}
};
Function stringToLong
= Functions.compose(integerToLong, stringToInteger);
Long actual = stringToLong.apply("5");
Long expected = 5L;
assertEquals(expected, actual);
}
}