Skip to content
Permalink
Browse files
Update maven-pmd-plugin
  • Loading branch information
amarkevich committed Nov 18, 2019
1 parent ccb9230 commit d3563e4de29cadb1549f7c24c1e8b707f26b8522
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
@@ -392,7 +392,7 @@ private String[] getArguments(XsdOption option, String outputDir)

List<URL> newCp = new ArrayList<URL>();
List<String> list = new ArrayList<String>();
if (extensions != null && extensions.size() > 0) {
if (extensions != null && !extensions.isEmpty()) {
try {
for (String ext : extensions) {
for (File file : resolve(ext)) {
@@ -181,19 +181,19 @@ private void assertDefaultElementValues(Foo foo) {
assertEquals("Unexpected value for element integerElem",
new BigInteger("11"), foo.getIntegerElem());
assertEquals("Unexpected value for element intElem",
new Integer(12), foo.getIntElem());
12, foo.getIntElem().intValue());
assertEquals("Unexpected value for element longElem",
new Long(13L), foo.getLongElem());
13L, foo.getLongElem().longValue());
assertEquals("Unexpected value for element shortElem",
new Short((short)14), foo.getShortElem());
(short)14, foo.getShortElem().shortValue());
assertEquals("Unexpected value for element decimalElem",
new BigDecimal("15"), foo.getDecimalElem());
assertEquals("Unexpected value for element floatElem",
new Float(16F), foo.getFloatElem());
assertEquals("Unexpected value for element doubleElem",
new Double(17D), foo.getDoubleElem());
assertEquals("Unexpected value for element byteElem",
new Byte((byte)18), foo.getByteElem());
(byte)18, foo.getByteElem().byteValue());

byte[] expected = DatatypeConverter.parseBase64Binary("abcdefgh");
byte[] effective = foo.getBase64BinaryElem();
@@ -217,11 +217,11 @@ private void assertDefaultElementValues(Foo foo) {
"string", qn.getLocalPart());

assertEquals("Unexpected value for element unsignedIntElem",
new Long(19L), foo.getUnsignedIntElem());
19L, foo.getUnsignedIntElem().longValue());
assertEquals("Unexpected value for element unsignedShortElem",
new Integer(20), foo.getUnsignedShortElem());
20, foo.getUnsignedShortElem().intValue());
assertEquals("Unexpected value for element unsignedByteElem",
new Short((short)21), foo.getUnsignedByteElem());
(short)21, foo.getUnsignedByteElem().shortValue());

assertEquals("Unexpected value for element durationElem",
0, foo.getDurationElem().getSeconds());
@@ -343,24 +343,24 @@ JExpression getDefaultValueExpression(FieldOutline f,
dv = JExpr.direct(Boolean.valueOf(defaultValue) ? "Boolean.TRUE" : "Boolean.FALSE");
} else if ("java.lang.Byte".equals(typeName) && isElement) {
dv = JExpr._new(type)
.arg(JExpr.cast(type.unboxify(),
JExpr.lit(new Byte(Short.valueOf(defaultValue).byteValue()))));
.arg(JExpr.cast(type.unboxify(),
JExpr.lit(Byte.parseByte(defaultValue))));
} else if ("java.lang.Double".equals(typeName) && isElement) {
dv = JExpr._new(type)
.arg(JExpr.lit(new Double(Double.valueOf(defaultValue).doubleValue())));
.arg(JExpr.lit(Double.parseDouble(defaultValue)));
} else if ("java.lang.Float".equals(typeName) && isElement) {
dv = JExpr._new(type)
.arg(JExpr.lit(new Float(Float.valueOf(defaultValue).floatValue())));
.arg(JExpr.lit(Float.parseFloat(defaultValue)));
} else if ("java.lang.Integer".equals(typeName) && isElement) {
dv = JExpr._new(type)
.arg(JExpr.lit(new Integer(Integer.valueOf(defaultValue).intValue())));
.arg(JExpr.lit(Integer.parseInt(defaultValue)));
} else if ("java.lang.Long".equals(typeName) && isElement) {
dv = JExpr._new(type)
.arg(JExpr.lit(new Long(Long.valueOf(defaultValue).longValue())));
.arg(JExpr.lit(Long.parseLong(defaultValue)));
} else if ("java.lang.Short".equals(typeName) && isElement) {
dv = JExpr._new(type)
.arg(JExpr.cast(type.unboxify(),
JExpr.lit(new Short(Short.valueOf(defaultValue).shortValue()))));
.arg(JExpr.cast(type.unboxify(),
JExpr.lit(Short.parseShort(defaultValue))));
} else if ("java.lang.String".equals(type.fullName()) && isElement) {
dv = JExpr.lit(defaultValue);
} else if ("java.math.BigInteger".equals(type.fullName()) && isElement) {
@@ -395,19 +395,19 @@ JExpression getDefaultValueExpression(FieldOutline f,
} else if (unbox) {
typeName = type.unboxify().fullName();
if ("int".equals(typeName)) {
dv = JExpr.lit(Integer.valueOf(defaultValue).intValue());
dv = JExpr.lit(Integer.parseInt(defaultValue));
} else if ("long".equals(typeName)) {
dv = JExpr.lit(Long.valueOf(defaultValue).longValue());
dv = JExpr.lit(Long.parseLong(defaultValue));
} else if ("short".equals(typeName)) {
dv = JExpr.lit(Short.valueOf(defaultValue).shortValue());
dv = JExpr.lit(Short.parseShort(defaultValue));
} else if ("boolean".equals(typeName)) {
dv = JExpr.lit(Boolean.valueOf(defaultValue).booleanValue());
dv = JExpr.lit(Boolean.parseBoolean(defaultValue));
} else if ("double".equals(typeName)) {
dv = JExpr.lit(Double.valueOf(defaultValue).doubleValue());
dv = JExpr.lit(Double.parseDouble(defaultValue));
} else if ("float".equals(typeName)) {
dv = JExpr.lit(Float.valueOf(defaultValue).floatValue());
dv = JExpr.lit(Float.parseFloat(defaultValue));
} else if ("byte".equals(typeName)) {
dv = JExpr.lit(Byte.valueOf(defaultValue).byteValue());
dv = JExpr.lit(Byte.parseByte(defaultValue));
} else {
dv = getDefaultValueExpression(f,
co,
@@ -414,7 +414,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.10.0</version>
<version>3.12.0</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf.build-utils</groupId>
@@ -548,7 +548,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.8.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
@@ -30,38 +30,38 @@

public class JAXBToStringBuilderTest {

final String dataV = "someData";
private static final String DATA = "someData";

@Test
public void testToString() throws Exception {
String res = JAXBToStringBuilder.valueOf(dataV);
Assert.assertEquals(res, dataV);
String res = JAXBToStringBuilder.valueOf(DATA);
Assert.assertEquals(res, DATA);
}

@Test
public void testToStringArray() throws Exception {
String[] data = new String[]{dataV};
String[] data = new String[]{DATA};
String res = JAXBToStringBuilder.valueOf(data);
Assert.assertTrue(res.indexOf(dataV) != -1);
Assert.assertTrue(res.indexOf(DATA) != -1);
}

@Test
public void testToStringCollection() throws Exception {
List<String> data = new ArrayList<String>();
data.add(dataV);
data.add(DATA);
String res = JAXBToStringBuilder.valueOf(data);
Assert.assertTrue(res.indexOf(dataV) != -1);
Assert.assertTrue(res.indexOf(DATA) != -1);
}


@Test
public void testToStringMap() throws Exception {
Map<String, String> data = new HashMap<String, String>();
data.put(dataV, dataV);
data.put(DATA, DATA);

// no content as it is not a Collection
String res = JAXBToStringBuilder.valueOf(data);
Assert.assertTrue(res.indexOf(dataV) == -1);
Assert.assertTrue(res.indexOf(DATA) == -1);
}

}

0 comments on commit d3563e4

Please sign in to comment.