@ -1,5 +1,5 @@
/ *
/ *
* Copyright 2012 - 2017 the original author or authors .
* Copyright 2012 - 2018 the original author or authors .
*
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* you may not use this file except in compliance with the License .
@ -142,6 +142,18 @@ public class PropertyMapperTests {
this . map . from ( ( ) - > "123" ) . whenEqualTo ( "321" ) . toCall ( Assert : : fail ) ;
this . map . from ( ( ) - > "123" ) . whenEqualTo ( "321" ) . toCall ( Assert : : fail ) ;
}
}
@Test
public void whenInstanceOfToWhenValueIsTargetTypeShouldMatch ( ) {
Long result = this . map . from ( ( ) - > 123L ) . whenInstanceOf ( Long . class )
. toInstance ( ( value ) - > value + 1 ) ;
assertThat ( result ) . isEqualTo ( 124L ) ;
}
@Test
public void whenInstanceOfWhenValueIsNotTargetTypeShouldNotMatch ( ) {
this . map . from ( ( ) - > 123 ) . whenInstanceOf ( Double . class ) . toCall ( Assert : : fail ) ;
}
@Test
@Test
public void whenWhenValueMatchesShouldMap ( ) {
public void whenWhenValueMatchesShouldMap ( ) {
String result = this . map . from ( ( ) - > "123" ) . when ( "123" : : equals )
String result = this . map . from ( ( ) - > "123" ) . when ( "123" : : equals )