From ff73575dff5baf2cfdb6a0115e0a02cc418f4f61 Mon Sep 17 00:00:00 2001 From: Yug Vajani Date: Wed, 13 Nov 2024 11:21:16 -0600 Subject: [PATCH] Fixed two non deterministic tests --- .../generator/BeanToArrayGenerationTestCase.java | 2 ++ .../test/metadata/ScoringClassMapBuilderTest.java | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/ma/glasnost/orika/test/generator/BeanToArrayGenerationTestCase.java b/core/src/test/java/ma/glasnost/orika/test/generator/BeanToArrayGenerationTestCase.java index 8f65cc1f..e7ec78d4 100644 --- a/core/src/test/java/ma/glasnost/orika/test/generator/BeanToArrayGenerationTestCase.java +++ b/core/src/test/java/ma/glasnost/orika/test/generator/BeanToArrayGenerationTestCase.java @@ -95,6 +95,8 @@ public void testBeanToStringArrayGeneration() throws Exception { .field("grade.percentage", "2") .field("name.first", "3") .field("name.last", "4") + .field("id", "5") + .field("email", "6") .byDefault() .register(); diff --git a/core/src/test/java/ma/glasnost/orika/test/metadata/ScoringClassMapBuilderTest.java b/core/src/test/java/ma/glasnost/orika/test/metadata/ScoringClassMapBuilderTest.java index 019833ad..e514e934 100644 --- a/core/src/test/java/ma/glasnost/orika/test/metadata/ScoringClassMapBuilderTest.java +++ b/core/src/test/java/ma/glasnost/orika/test/metadata/ScoringClassMapBuilderTest.java @@ -79,11 +79,19 @@ public static class Country { } @Test - public void testClassMapBuilderExtension() { - + public void testClassMapBuilderExtension() { + MapperFactory factory = new DefaultMapperFactory.Builder().classMapBuilderFactory(new ScoringClassMapBuilder.Factory()).build(); - ClassMap map = factory.classMap(Source.class, Destination.class).byDefault().toClassMap(); + ClassMap map = factory.classMap(Source.class, Destination.class) + .field("firstName", "name.first") + .field("lastName", "name.last") + .field("postalAddress.street", "streetAddress") + .field("postalAddress.country.alphaCode", "countryCode") + .field("age", "currentAge") + .field("stateOfBirth", "birthState") + .byDefault() + .toClassMap(); Map mapping = new HashMap<>(); for (FieldMap f : map.getFieldsMapping()) { mapping.put(f.getSource().getExpression(), f.getDestination().getExpression());