#94 Formatting, renaming test

This commit is contained in:
Gunnar Morling 2014-01-19 23:56:35 +01:00
parent e82277e0fc
commit 77e6890b00
10 changed files with 31 additions and 35 deletions

View File

@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier; import javax.lang.model.element.Modifier;
@ -66,7 +65,8 @@ public class Method {
returnType, returnType,
Collections.<String, List<Mapping>>emptyMap(), Collections.<String, List<Mapping>>emptyMap(),
null, null,
null ); null
);
} }
private Method(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters, Type returnType, private Method(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters, Type returnType,

View File

@ -259,8 +259,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
} }
} }
} }
else if (executables.getPropertyName( getter ).equals( sourcePropertyName )) else if ( executables.getPropertyName( getter ).equals( sourcePropertyName ) ) {
{
return getPropertyMapping( return getPropertyMapping(
methods, methods,
method, method,

View File

@ -18,13 +18,10 @@
*/ */
package org.mapstruct.ap.processor; package org.mapstruct.ap.processor;
import static javax.lang.model.util.ElementFilter.methodsIn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.processing.Messager; import javax.annotation.processing.Messager;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier; import javax.lang.model.element.Modifier;
@ -49,6 +46,8 @@ import org.mapstruct.ap.model.source.Method;
import org.mapstruct.ap.util.Executables; import org.mapstruct.ap.util.Executables;
import org.mapstruct.ap.util.TypeFactory; import org.mapstruct.ap.util.TypeFactory;
import static javax.lang.model.util.ElementFilter.methodsIn;
/** /**
* A {@link ModelElementProcessor} which retrieves a list of {@link Method}s * A {@link ModelElementProcessor} which retrieves a list of {@link Method}s
* representing all the mapping methods of the given bean mapper type as well as * representing all the mapping methods of the given bean mapper type as well as

View File

@ -19,7 +19,6 @@
package org.mapstruct.ap.test.severaltargets; package org.mapstruct.ap.test.severaltargets;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class Source { public class Source {

View File

@ -18,28 +18,31 @@
*/ */
package org.mapstruct.ap.test.severaltargets; package org.mapstruct.ap.test.severaltargets;
import static org.fest.assertions.Assertions.assertThat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.MapperTestBase; import org.mapstruct.ap.testutil.MapperTestBase;
import org.mapstruct.ap.testutil.WithClasses; import org.mapstruct.ap.testutil.WithClasses;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.fest.assertions.Assertions.assertThat;
import org.mapstruct.ap.testutil.IssueKey;
/** /**
* Test for the generation of implementation of abstract base classes. * Test for the generation of implementation of abstract base classes.
* *
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
@WithClasses({ Source.class, Target.class, SourceTargetMapper.class, TimeAndFormat.class, @WithClasses({
TimeAndFormatMapper.class }) Source.class, Target.class, SourceTargetMapper.class, TimeAndFormat.class,
public class MultipleSourcesTest extends MapperTestBase { TimeAndFormatMapper.class
})
public class SourcePropertyMapSeveralTimesTest extends MapperTestBase {
@Test @Test
@IssueKey("94") @IssueKey("94")
public void shouldMapMultipleSources() throws ParseException { public void shouldMapSameSourcePropertyToSeveralTargetProperties() throws ParseException {
Source source = new Source(); Source source = new Source();
String sourceFormat = "dd-MM-yyyy"; String sourceFormat = "dd-MM-yyyy";
SimpleDateFormat dateFormat = new SimpleDateFormat( sourceFormat ); SimpleDateFormat dateFormat = new SimpleDateFormat( sourceFormat );

View File

@ -24,7 +24,6 @@ import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
@Mapper(uses = TimeAndFormatMapper.class) @Mapper(uses = TimeAndFormatMapper.class)

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.severaltargets;
import java.util.Date; import java.util.Date;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class Target { public class Target {

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.severaltargets;
import java.util.Date; import java.util.Date;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class TimeAndFormat { public class TimeAndFormat {

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.severaltargets;
import java.util.Date; import java.util.Date;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class TimeAndFormatMapper { public class TimeAndFormatMapper {