mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
Use DefaultLocale for more stable Issue2544MapperTest (#2569)
This commit is contained in:
parent
9ed4e389f8
commit
9057d68cd2
@ -9,6 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import org.junitpioneer.jupiter.DefaultLocale;
|
||||||
import org.mapstruct.ap.testutil.IssueKey;
|
import org.mapstruct.ap.testutil.IssueKey;
|
||||||
import org.mapstruct.ap.testutil.ProcessorTest;
|
import org.mapstruct.ap.testutil.ProcessorTest;
|
||||||
import org.mapstruct.ap.testutil.WithClasses;
|
import org.mapstruct.ap.testutil.WithClasses;
|
||||||
@ -19,12 +20,23 @@ import org.mapstruct.ap.testutil.WithClasses;
|
|||||||
@IssueKey( "2544" )
|
@IssueKey( "2544" )
|
||||||
@WithClasses( { Issue2544Mapper.class } )
|
@WithClasses( { Issue2544Mapper.class } )
|
||||||
public class Issue2544Test {
|
public class Issue2544Test {
|
||||||
|
// Parsing numbers is sensitive to locale settings (e.g. decimal point)
|
||||||
|
|
||||||
@ProcessorTest
|
@ProcessorTest
|
||||||
public void shouldConvert() {
|
@DefaultLocale("en")
|
||||||
|
public void shouldConvertEn() {
|
||||||
Issue2544Mapper.Target target = Issue2544Mapper.INSTANCE.map( "123.45679E6" );
|
Issue2544Mapper.Target target = Issue2544Mapper.INSTANCE.map( "123.45679E6" );
|
||||||
|
|
||||||
assertThat( target ).isNotNull();
|
assertThat( target ).isNotNull();
|
||||||
assertThat( target.getBigNumber() ).isEqualTo( new BigDecimal( "1.2345679E+8" ) );
|
assertThat( target.getBigNumber() ).isEqualTo( new BigDecimal( "1.2345679E+8" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ProcessorTest
|
||||||
|
@DefaultLocale("de")
|
||||||
|
public void shouldConvertDe() {
|
||||||
|
Issue2544Mapper.Target target = Issue2544Mapper.INSTANCE.map( "123,45679E6" );
|
||||||
|
|
||||||
|
assertThat( target ).isNotNull();
|
||||||
|
assertThat( target.getBigNumber() ).isEqualTo( new BigDecimal( "1.2345679E+8" ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user