#459 error message parameter forgotten

This commit is contained in:
sjaakd 2015-02-17 14:37:29 +01:00
parent 1659a6e8e5
commit fe10248416
5 changed files with 165 additions and 3 deletions

View File

@ -50,11 +50,11 @@ public enum Message {
CONSTANTMAPPING_MAPPING_NOT_FOUND( "Can't map \"%s %s\" to \"%s %s\"." ),
MAPMAPPING_KEY_MAPPING_NOT_FOUND( "Can't create implementation of method %s. Found no method nor built-in conversion for mapping source key type to target key type." ),
MAPMAPPING_VALUE_MAPPING_NOT_FOUND( "Can't create implementation of method %s. Found no method nor built-in conversion for mapping source value type to target value type." ),
MAPMAPPING_KEY_MAPPING_NOT_FOUND( "No implementation can be generated for this method. Found no method nor implicit conversion for mapping source key type to target key type." ),
MAPMAPPING_VALUE_MAPPING_NOT_FOUND( "No implementation can be generated for this method. Found no method nor implicit conversion for mapping source value type to target value type." ),
MAPMAPPING_NO_ELEMENTS( "'keyDateFormat', 'keyQualifiedBy', 'keyTargetType', 'valueDateFormat', 'valueQualfiedBy' and 'valueTargetType' are all undefined in @MapMapping, define at least one of them." ),
ITERABLEMAPPING_MAPPING_NOT_FOUND( "Can't create implementation of method %s. Found no method nor built-in conversion for mapping source element type into target element type." ),
ITERABLEMAPPING_MAPPING_NOT_FOUND( "No implementation can be generated for this method. Found no method nor implicit conversion for mapping source element type into target element type." ),
ITERABLEMAPPING_NO_ELEMENTS( "'dateformat', 'qualifiedBy' and 'elementTargetType' are undefined in @IterableMapping, define at least one of them." ),
ENUMMAPPING_MULTIPLE_TARGETS( "One enum constant must not be mapped to more than one target constant, but constant %s is mapped to %s." ),

View File

@ -88,4 +88,52 @@ public class ErroneousCollectionMappingTest {
)
public void shouldFailOnEmptyMapAnnotation() {
}
@Test
@IssueKey("459")
@WithClasses({ ErroneousCollectionNoElementMappingFound.class })
@ExpectedCompilationOutcome(
value = CompilationResult.FAILED,
diagnostics = {
@Diagnostic(type = ErroneousCollectionNoElementMappingFound.class,
kind = Kind.ERROR,
line = 36,
messageRegExp = "No implementation can be generated for this method. Found no method nor implicit "
+ "conversion for mapping source element type into target element type.")
}
)
public void shouldFailOnNoElementMappingFound() {
}
@Test
@IssueKey("459")
@WithClasses({ ErroneousCollectionNoKeyMappingFound.class })
@ExpectedCompilationOutcome(
value = CompilationResult.FAILED,
diagnostics = {
@Diagnostic(type = ErroneousCollectionNoKeyMappingFound.class,
kind = Kind.ERROR,
line = 36,
messageRegExp = "No implementation can be generated for this method. Found no method nor implicit "
+ "conversion for mapping source key type to target key type.")
}
)
public void shouldFailOnNoKeyMappingFound() {
}
@Test
@IssueKey("459")
@WithClasses({ ErroneousCollectionNoValueMappingFound.class })
@ExpectedCompilationOutcome(
value = CompilationResult.FAILED,
diagnostics = {
@Diagnostic(type = ErroneousCollectionNoValueMappingFound.class,
kind = Kind.ERROR,
line = 36,
messageRegExp = "No implementation can be generated for this method. Found no method nor implicit "
+ "conversion for mapping source value type to target value type.")
}
)
public void shouldFailOnNoValueMappingFound() {
}
}

View File

@ -0,0 +1,38 @@
/**
* Copyright 2012-2015 Gunnar Morling (http://www.gunnarmorling.de/)
* and/or other contributors as indicated by the @authors tag. See the
* copyright.txt file in the distribution for a full listing of all
* contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.collection.erroneous;
import java.text.AttributedString;
import java.util.List;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
*
* @author Sjaak Derksen
*/
@Mapper
public interface ErroneousCollectionNoElementMappingFound {
ErroneousCollectionNoElementMappingFound INSTANCE =
Mappers.getMapper( ErroneousCollectionNoElementMappingFound.class );
List<String> map(List<AttributedString> source);
}

View File

@ -0,0 +1,38 @@
/**
* Copyright 2012-2015 Gunnar Morling (http://www.gunnarmorling.de/)
* and/or other contributors as indicated by the @authors tag. See the
* copyright.txt file in the distribution for a full listing of all
* contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.collection.erroneous;
import java.text.AttributedString;
import java.util.Map;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
*
* @author Sjaak Derksen
*/
@Mapper
public interface ErroneousCollectionNoKeyMappingFound {
ErroneousCollectionNoKeyMappingFound INSTANCE =
Mappers.getMapper( ErroneousCollectionNoKeyMappingFound.class );
Map<String, String> map(Map<AttributedString, String> source);
}

View File

@ -0,0 +1,38 @@
/**
* Copyright 2012-2015 Gunnar Morling (http://www.gunnarmorling.de/)
* and/or other contributors as indicated by the @authors tag. See the
* copyright.txt file in the distribution for a full listing of all
* contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.collection.erroneous;
import java.text.AttributedString;
import java.util.Map;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
*
* @author Sjaak Derksen
*/
@Mapper
public interface ErroneousCollectionNoValueMappingFound {
ErroneousCollectionNoValueMappingFound INSTANCE =
Mappers.getMapper( ErroneousCollectionNoValueMappingFound.class );
Map<String, String> map(Map<String, AttributedString> source);
}