Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
oswaldobapvicjr committed May 18, 2023
1 parent 47ff76c commit 4fab0df
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
*/
public class PropertiesToObjectMapper<T> implements Mapper<T>
{
private static final String MSG_UNABLE_TO_PARSE_PROPERTY = "Unable to parse the value of the property '%s' into a field of type '%s'";

private final Class<T> targetType;

/**
Expand Down Expand Up @@ -136,8 +138,7 @@ private void writeField(T targetObject, Field field, Properties properties) thro
}
catch (ParseException exception)
{
throw new ConfigurationException(exception,
"Unable to parse the value of the property '%s' into a field of type '%s'",
throw new ConfigurationException(exception, MSG_UNABLE_TO_PARSE_PROPERTY,
propertyKey, fieldType.getCanonicalName());
}
}
Expand Down
16 changes: 16 additions & 0 deletions confectory-core/src/test/java/net/obvj/confectory/TestUtils.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 obvj.net
*
* 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 net.obvj.confectory;

import java.util.Calendar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void constructor_validMessage_validMessageAndNoCause()
{
throw new ParseException(DETAILED_MESSAGE1);
},
throwsException(ParseException.class)
throwsException(ParseException.class)
.withMessage(DETAILED_MESSAGE1)
.withCause(null));
}
Expand All @@ -51,7 +51,7 @@ void constructor_validCause_validMessageAndCause()
{
throw new ParseException(new IllegalArgumentException(ROOT_CAUSE_MESSAGE1));
},
throwsException(ParseException.class)
throwsException(ParseException.class)
.withMessage(endsWith(ROOT_CAUSE_MESSAGE1))
.withCause(IllegalArgumentException.class));
}
Expand All @@ -64,7 +64,7 @@ void constructor_validMessageAndCause_validMessageAndCause()
throw new ParseException(new IllegalArgumentException(ROOT_CAUSE_MESSAGE1),
DETAILED_MESSAGE1);
},
throwsException(ParseException.class)
throwsException(ParseException.class)
.withMessage(DETAILED_MESSAGE1)
.withCause(IllegalArgumentException.class));
}
Expand Down

0 comments on commit 4fab0df

Please sign in to comment.