Skip to content

Commit

Permalink
Moved test mapping to standard location (#636)
Browse files Browse the repository at this point in the history
  • Loading branch information
garethahealy committed May 6, 2018
1 parent c0c5307 commit 83551ef
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 38 deletions.
Expand Up @@ -65,7 +65,7 @@ public void tearDown() {
@Test
public void shouldBeThreadSafe() throws Exception {
Mapper mapper = DozerBeanMapperBuilder.create()
.withMappingFiles("testDozerBeanMapping.xml")
.withMappingFiles("mappings/testDozerBeanMapping.xml")
.build();

final CountDownLatch latch = new CountDownLatch(THREAD_COUNT);
Expand Down
Expand Up @@ -71,7 +71,7 @@ public void testManyObjects() {
}

Mapper mapper = DozerBeanMapperBuilder.create()
.withMappingFiles("testDozerBeanMapping.xml")
.withMappingFiles("mappings/testDozerBeanMapping.xml")
.build();
mapper.map(a, b);

Expand Down
Expand Up @@ -159,7 +159,7 @@ public void testArrayToStringCustomConverter() {

@Test
public void testCustomConverterMapping() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
TestCustomConverterObject obj = newInstance(TestCustomConverterObject.class);
CustomDoubleObjectIF doub = newInstance(CustomDoubleObject.class);
doub.setTheDouble(15);
Expand Down Expand Up @@ -215,7 +215,7 @@ public void testCustomConverterMapping() {
@Test
public void testCustomConverterWithPrimitive() {
// test primitive double
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
TestCustomConverterObjectPrime prime = newInstance(TestCustomConverterObjectPrime.class);
prime.setPrimitiveDoubleAttribute(25.00);
prime.setDoubleAttribute(new Double(30.00));
Expand All @@ -232,7 +232,7 @@ public void testCustomConverterWithPrimitive() {

@Test
public void testCustomConverterHashMapMapping() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
TestCustomConverterHashMapObject testCustomConverterHashMapObject = newInstance(TestCustomConverterHashMapObject.class);
TestObject to = newInstance(TestObject.class);
to.setOne("one");
Expand Down
Expand Up @@ -39,7 +39,7 @@ public class DeepMappingTest extends AbstractFunctionalTest {

@Test
public void testDeepMapping() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
SrcDeepObj src = testDataFactory.getSrcDeepObj();
DestDeepObj dest = mapper.map(src, DestDeepObj.class);
SrcDeepObj src2 = mapper.map(dest, SrcDeepObj.class);
Expand All @@ -51,7 +51,7 @@ public void testDeepMapping() {

@Test
public void testDeepPropertyOneWay() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
House house = newInstance(House.class);
Person owner = newInstance(Person.class);
owner.setYourName("myName");
Expand Down
Expand Up @@ -51,7 +51,7 @@ public class DozerBeanMapperTest extends AbstractDozerTest {
@Before
public void setUp() throws Exception {
mapper = DozerBeanMapperBuilder.create()
.withMappingFiles("testDozerBeanMapping.xml")
.withMappingFiles("mappings/testDozerBeanMapping.xml")
.build();
}

Expand Down
Expand Up @@ -606,7 +606,7 @@ public void testGlobalBeanFactoryAppliedToDefaultMappings() {

@Test
public void testStringToDateMapping() throws Exception {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss:SS");
String dateStr = "01/29/1975 10:45:13:25";
TestObject sourceObj = newInstance(TestObject.class);
Expand All @@ -622,7 +622,7 @@ public void testStringToDateMapping() throws Exception {

@Test
public void testMethodMapping() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
MethodFieldTestObject sourceObj = newInstance(MethodFieldTestObject.class);
sourceObj.setIntegerStr("1500");
sourceObj.setPriceItem("3500");
Expand All @@ -641,7 +641,7 @@ public void testMethodMapping() {
@Test
public void testNoReadMethod() {
// If the field doesnt have a getter/setter, dont add it is a default field to be mapped.
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
NoReadMethod src = newInstance(NoReadMethod.class);
src.setNoReadMethod("somevalue");

Expand All @@ -652,7 +652,7 @@ public void testNoReadMethod() {
@Test
public void testNoReadMethodSameClassTypes() {
// If the field doesnt have a getter/setter, dont add it is a default field to be mapped.
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
NoReadMethod src = newInstance(NoReadMethod.class);
src.setNoReadMethod("somevalue");

Expand All @@ -663,7 +663,7 @@ public void testNoReadMethodSameClassTypes() {
@Test
public void testNoReadMethod_GetterOnlyWithParams() {
// Dont use getter methods that have a param when discovering default fields to be mapped.
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
NoReadMethod src = newInstance(NoReadMethod.class);
src.setOtherNoReadMethod("someValue");

Expand All @@ -673,7 +673,7 @@ public void testNoReadMethod_GetterOnlyWithParams() {

@Test
public void testNoWriteMethod() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
NoWriteMethod src = newInstance(NoWriteMethod.class);
src.setXXXXXX("someValue");

Expand All @@ -685,7 +685,7 @@ public void testNoWriteMethod() {
public void testNoWriteMethodSameClassTypes() {
// When mapping between identical types, if the field doesnt have a getter/setter, dont
// add it is a default field to be mapped.
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
NoWriteMethod src = newInstance(NoWriteMethod.class);
src.setXXXXXX("someValue");

Expand All @@ -697,7 +697,7 @@ public void testNoWriteMethodSameClassTypes() {

@Test
public void testNoVoidSetters() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
NoVoidSetters src = newInstance(NoVoidSetters.class);
src.setDescription("someValue");
src.setI(1);
Expand All @@ -709,7 +709,7 @@ public void testNoVoidSetters() {

@Test
public void testNullField() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
AnotherTestObject src = newInstance(AnotherTestObject.class);
src.setField2(null);
AnotherTestObjectPrime dest = newInstance(AnotherTestObjectPrime.class);
Expand All @@ -721,7 +721,7 @@ public void testNullField() {

@Test
public void testNullField2() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
// Test that String --> String with an empty String input value results
// in the destination field being an empty String and not null.
String input = "";
Expand All @@ -735,7 +735,7 @@ public void testNullField2() {

@Test
public void testNullToPrimitive() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
AnotherTestObject src = newInstance(AnotherTestObject.class);
AnotherTestObjectPrime prime = newInstance(AnotherTestObjectPrime.class);
TestObject to = newInstance(TestObject.class);
Expand Down
Expand Up @@ -145,7 +145,7 @@ public void testNoCustomMappingForSubclasses_CustomMappingForSuperClasses() {

@Test
public void testGeneralInheritance() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
// first test mapping of sub and base class to a single class
com.github.dozermapper.core.vo.inheritance.SubClass sub = newInstance(com.github.dozermapper.core.vo.inheritance.SubClass.class);

Expand All @@ -160,7 +160,7 @@ public void testGeneralInheritance() {

@Test
public void testGeneralInheritance2() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
// test base to base and sub to sub mapping with an intermediate on the destination
AnotherSubClass asub = newInstance(AnotherSubClass.class);
asub.setBaseAttribute("base");
Expand Down Expand Up @@ -236,7 +236,7 @@ public void testGeneralInheritance2() {

@Test
public void testInheritanceWithAbstractClassOrInterfaceAsDestination() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
SpecificObject so = newInstance(SpecificObject.class);
so.setSuperAttr1("superAttr1");

Expand Down Expand Up @@ -266,7 +266,7 @@ public void testInheritanceWithAbstractClassOrInterfaceAsDestination() {

@Test
public void testComplexSuperClassMapping() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
SubClass obj = testDataFactory.getSubClass();
SubClassPrime objPrime = mapper.map(obj, SubClassPrime.class);
SubClass obj2 = mapper.map(objPrime, SubClass.class);
Expand Down Expand Up @@ -323,7 +323,7 @@ public void testComplexSuperClassMapping() {
@Test
public void testSuperClassMapping() {
// source object does not extend a base custom data object, but destination object extends a custom data object.
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
NoSuperClass src = newInstance(NoSuperClass.class);
src.setAttribute("somefieldvalue");
src.setSuperAttribute("someotherfieldvalue");
Expand Down
Expand Up @@ -222,7 +222,7 @@ public void testVoToMap_NoCustomMappings() {

@Test
public void testMapToMap() {
Mapper mapper = getMapper("mappings/mapInterfaceMapping.xml", "testDozerBeanMapping.xml");
Mapper mapper = getMapper("mappings/mapInterfaceMapping.xml", "mappings/testDozerBeanMapping.xml");
TestObject to = newInstance(TestObject.class);
to.setOne("one");
TestObject to2 = newInstance(TestObject.class);
Expand All @@ -247,7 +247,7 @@ public void testMapToMap() {

@Test
public void testMapToMapExistingDestination() {
Mapper mapper = getMapper("mappings/mapInterfaceMapping.xml", "testDozerBeanMapping.xml");
Mapper mapper = getMapper("mappings/mapInterfaceMapping.xml", "mappings/testDozerBeanMapping.xml");
TestObject to = newInstance(TestObject.class);
to.setOne("one");
TestObject to2 = newInstance(TestObject.class);
Expand All @@ -273,7 +273,7 @@ public void testMapToMapExistingDestination() {

@Test
public void testPropertyClassLevelMap() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
PropertyToMap ptm = newInstance(PropertyToMap.class);
ptm.setStringProperty("stringPropertyValue");
ptm.addStringProperty2("stringProperty2Value");
Expand All @@ -294,7 +294,7 @@ public void testPropertyClassLevelMap() {

@Test
public void testPropertyClassLevelMap2() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
PropertyToMap ptm = newInstance(PropertyToMap.class);
ptm.setStringProperty("stringPropertyValue");
ptm.addStringProperty2("stringProperty2Value");
Expand All @@ -307,7 +307,7 @@ public void testPropertyClassLevelMap2() {
@Test
public void testPropertyClassLevelMapBack() {
// Map Back
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
Map<String, Object> map = newInstance(HashMap.class);
map.put("stringProperty", "stringPropertyValue");
map.put("integerProperty", new Integer("567"));
Expand All @@ -326,7 +326,7 @@ public void testPropertyClassLevelMapBack() {

@Test
public void testPropertyToMap() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
PropertyToMap ptm = newInstance(PropertyToMap.class);
ptm.setStringProperty("stringPropertyValue");
ptm.addStringProperty2("stringProperty2Value");
Expand Down Expand Up @@ -356,7 +356,7 @@ public void testPropertyToMap() {

@Test
public void testPropertyToCustomMap() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
PropertyToMap ptm = newInstance(PropertyToMap.class);
ptm.setStringProperty3("stringProperty3Value");
ptm.setStringProperty4("stringProperty4Value");
Expand All @@ -376,7 +376,7 @@ public void testPropertyToCustomMap() {

@Test
public void testPropertyToClassLevelMap() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
MapTestObject mto = newInstance(MapTestObject.class);
PropertyToMap ptm = newInstance(PropertyToMap.class);
Map<String, String> map = newInstance(HashMap.class);
Expand Down Expand Up @@ -425,7 +425,7 @@ public void testPropertyToClassLevelMap() {

@Test
public void testPropertyToCustomClassLevelMap() {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
MapTestObject mto = newInstance(MapTestObject.class);
PropertyToMap ptm = newInstance(PropertyToMap.class);
ptm.setStringProperty("stringPropertyValue");
Expand Down
Expand Up @@ -72,7 +72,7 @@ public class MapperTest extends AbstractFunctionalTest {
@Override
@Before
public void setUp() throws Exception {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
}

@Test
Expand Down
Expand Up @@ -28,7 +28,7 @@ public class MultiThreadedTest extends AbstractFunctionalTest {
@Override
@Before
public void setUp() throws Exception {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
}

/*
Expand Down
Expand Up @@ -47,7 +47,7 @@ public class PerformanceTest extends AbstractFunctionalTest {
@Before
public void setUp() throws Exception {
if (mapper == null) {
mapper = getMapper("testDozerBeanMapping.xml");
mapper = getMapper("mappings/testDozerBeanMapping.xml");
}
}

Expand Down
Expand Up @@ -43,7 +43,7 @@ public void setUp() throws Exception {

@Test
public void loadFromStreamTest() throws IOException {
InputStream xmlStream = getClass().getClassLoader().getResourceAsStream("testDozerBeanMapping.xml");
InputStream xmlStream = getClass().getClassLoader().getResourceAsStream("mappings/testDozerBeanMapping.xml");
MappingFileData data = streamReader.read(xmlStream);
xmlStream.close();

Expand Down
Expand Up @@ -54,7 +54,7 @@ public void setUp() {

@Test
public void testParse() throws Exception {
URL url = loader.getResource("testDozerBeanMapping.xml");
URL url = loader.getResource("mappings/testDozerBeanMapping.xml");

Document document = new XMLParserFactory(beanContainer).createParser().parse(url.openStream());
parser = new XMLParser(beanContainer, destBeanCreator, propertyDescriptorFactory);
Expand Down

0 comments on commit 83551ef

Please sign in to comment.