-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test for issue #101: NPE on primitive arrays in beans converted to maps
- Loading branch information
Showing
6 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
de.gebit.integrity.tests/integrity/suites/basic/beans/primitiveArrayBeanTest.integrity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import integrity.fixtures.basic.beans.* | ||
|
||
packagedef integrity.basic.beans with | ||
|
||
suitedef primitiveArrayBeanTest with | ||
|
||
variable testvar | ||
|
||
call createPrimitiveTypeArrayTestBean -> testvar | ||
|
||
// This converts the resulting map to a string for inclusion into the results, therefore the map is tested | ||
call echoMapCall bean: testvar -> testvar | ||
|
||
suiteend | ||
|
||
packageend |
43 changes: 43 additions & 0 deletions
43
...egrity.tests/junit/de/gebit/integrity/tests/junit/basic/beans/PrimitiveArrayBeanTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2013 Rene Schneider, GEBIT Solutions GmbH and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
package de.gebit.integrity.tests.junit.basic.beans; | ||
|
||
import java.io.IOException; | ||
|
||
import org.jdom.Document; | ||
import org.jdom.JDOMException; | ||
import org.junit.Test; | ||
|
||
import de.gebit.integrity.runner.exceptions.ModelLoadException; | ||
import de.gebit.integrity.tests.junit.IntegrityJUnitTest; | ||
|
||
/** | ||
* JUnit test which checks bean calls. | ||
* | ||
* | ||
* @author Rene Schneider - initial API and implementation | ||
* | ||
*/ | ||
public class PrimitiveArrayBeanTest extends IntegrityJUnitTest { | ||
|
||
/** | ||
* Performs a suite which does fixture calls with bean values and checks the resulting XML document. | ||
* | ||
* @throws ModelLoadException | ||
* @throws IOException | ||
* @throws JDOMException | ||
*/ | ||
@Test | ||
public void test() throws ModelLoadException, IOException, JDOMException { | ||
Document tempResult = executeIntegritySuite( | ||
new String[] { "integrity/suites/basic/beans/primitiveArrayBeanTest.integrity" }, | ||
"integrity.basic.beans.primitiveArrayBeanTest", null); | ||
assertDocumentMatchesReference(tempResult); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
de.gebit.integrity.tests/results/integrity.basic.beans.primitiveArrayBeanTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<integrity name="Integrity JUnit Testing" timestamp="30.11.15 09:55" isotimestamp="2015-11-30T09:55:56" duration="25.182"> | ||
<variables /> | ||
<suite id="0" name="integrity.basic.beans.primitiveArrayBeanTest" timestamp="30.11.15 09:55:56.0458"> | ||
<setup /> | ||
<variables> | ||
<variable name="testvar" /> | ||
</variables> | ||
<statements> | ||
<call id="1" line="9" name="createPrimitiveTypeArrayTestBean" description="creates an instance of PrimitiveTypeArrayTestBean" fixture="de.gebit.integrity.tests.fixtures.basic.beans.BeanFixture#createPrimitiveTypeArrayTestBean" timestamp="30.11.15 09:55:56.0474"> | ||
<parameters /> | ||
<result duration="0.816" type="success"> | ||
<variableUpdate name="testvar" value="de.gebit.integrity.tests.fixtures.basic.beans.PrimitiveTypeArrayTestBean@78f6e005" /> | ||
</result> | ||
</call> | ||
<call id="2" line="12" name="echoMapCall" description="echoes the input as a map converted by Integrity" fixture="de.gebit.integrity.tests.fixtures.basic.beans.BeanFixture#echoMap" timestamp="30.11.15 09:55:56.0474"> | ||
<parameters> | ||
<parameter name="bean" value="de.gebit.integrity.tests.fixtures.basic.beans.PrimitiveTypeArrayTestBean@78f6e005" /> | ||
</parameters> | ||
<result duration="3.052" type="success"> | ||
<variableUpdate name="testvar" value="[FORMATTED]{[NL][T]primitiveBoolean = true, false[NL|, ][T]primitiveByte = 1, 2, 3[NL|, ][T]primitiveChar = a, b, c[NL|, ][T]primitiveDouble = 1.0, 1.1, 1.2[NL|, ][T]primitiveFloat = 1.0, 1.1, 1.2[NL|, ][T]primitiveInt = 1, 2, 3[NL|, ][T]primitiveLong = 1, 2, 3[NL|, ][T]primitiveShort = 1, 2, 3[NL]}" /> | ||
</result> | ||
</call> | ||
</statements> | ||
<teardown /> | ||
<result duration="18.766" successCount="0" failureCount="0" exceptionCount="0" testExceptionCount="0" callExceptionCount="0" /> | ||
</suite> | ||
</integrity> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
...y.tests/src/de/gebit/integrity/tests/fixtures/basic/beans/PrimitiveTypeArrayTestBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2013 Rene Schneider, GEBIT Solutions GmbH and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
package de.gebit.integrity.tests.fixtures.basic.beans; | ||
|
||
//SUPPRESS CHECKSTYLE LONG Javadoc | ||
public class PrimitiveTypeArrayTestBean { | ||
|
||
private int[] primitiveInt; | ||
|
||
private long[] primitiveLong; | ||
|
||
private short[] primitiveShort; | ||
|
||
private byte[] primitiveByte; | ||
|
||
private double[] primitiveDouble; | ||
|
||
private float[] primitiveFloat; | ||
|
||
private char[] primitiveChar; | ||
|
||
private boolean[] primitiveBoolean; | ||
|
||
public int[] getPrimitiveInt() { | ||
return primitiveInt; | ||
} | ||
|
||
public void setPrimitiveInt(int[] primitiveInt) { | ||
this.primitiveInt = primitiveInt; | ||
} | ||
|
||
public long[] getPrimitiveLong() { | ||
return primitiveLong; | ||
} | ||
|
||
public void setPrimitiveLong(long[] primitiveLong) { | ||
this.primitiveLong = primitiveLong; | ||
} | ||
|
||
public short[] getPrimitiveShort() { | ||
return primitiveShort; | ||
} | ||
|
||
public void setPrimitiveShort(short[] primitiveShort) { | ||
this.primitiveShort = primitiveShort; | ||
} | ||
|
||
public byte[] getPrimitiveByte() { | ||
return primitiveByte; | ||
} | ||
|
||
public void setPrimitiveByte(byte[] primitiveByte) { | ||
this.primitiveByte = primitiveByte; | ||
} | ||
|
||
public double[] getPrimitiveDouble() { | ||
return primitiveDouble; | ||
} | ||
|
||
public void setPrimitiveDouble(double[] primitiveDouble) { | ||
this.primitiveDouble = primitiveDouble; | ||
} | ||
|
||
public float[] getPrimitiveFloat() { | ||
return primitiveFloat; | ||
} | ||
|
||
public void setPrimitiveFloat(float[] primitiveFloat) { | ||
this.primitiveFloat = primitiveFloat; | ||
} | ||
|
||
public char[] getPrimitiveChar() { | ||
return primitiveChar; | ||
} | ||
|
||
public void setPrimitiveChar(char[] primitiveChar) { | ||
this.primitiveChar = primitiveChar; | ||
} | ||
|
||
public boolean[] getPrimitiveBoolean() { | ||
return primitiveBoolean; | ||
} | ||
|
||
public void setPrimitiveBoolean(boolean[] primitiveBoolean) { | ||
this.primitiveBoolean = primitiveBoolean; | ||
} | ||
|
||
} |