Last active
December 20, 2015 22:39
-
-
Save jexp/6207109 to your computer and use it in GitHub Desktop.
error in case: get double array (4 elements) property, modify it, write it back, get it again -> wrong values
This file contains hidden or 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
| arrays first differed at element [2]; expected:<15.0> but was:<13.0> | |
| arrays first differed at element [2]; expected:<25.0> but was:<21.0> | |
| arrays first differed at element [2]; expected:<99.0> but was:<73.0> | |
| arrays first differed at element [2]; expected:<99.0> but was:<73.0> | |
| Expected :99.0 | |
| Actual :73.0 | |
| <Click to see difference> | |
| at org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:50) | |
| at org.junit.Assert.assertArrayEquals(Assert.java:419) | |
| at org.junit.Assert.assertArrayEquals(Assert.java:430) | |
| at org.neo4j.collections.DoubleArrayUpdateTest.testUpdateDoubleArrayProperty(DoubleArrayUpdateTest.java:35) | |
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
| at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) | |
| at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) | |
| at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) | |
| at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) | |
| at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) | |
| at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) | |
| at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) | |
| at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) | |
| at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) | |
| at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) | |
| at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) | |
| at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) | |
| at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) | |
| at org.junit.runners.ParentRunner.run(ParentRunner.java:309) | |
| at org.junit.runner.JUnitCore.run(JUnitCore.java:160) | |
| at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) | |
| at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202) | |
| at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65) | |
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
| at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) |
This file contains hidden or 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
| import org.junit.Before; | |
| import org.junit.Test; | |
| import org.neo4j.graphdb.GraphDatabaseService; | |
| import org.neo4j.graphdb.Node; | |
| import org.neo4j.test.TestGraphDatabaseFactory; | |
| import static org.junit.Assert.assertArrayEquals; | |
| public class DoubleArrayUpdateTest { | |
| private GraphDatabaseService db; | |
| @Before | |
| public void setUp() throws Exception { | |
| db = new TestGraphDatabaseFactory().newImpermanentDatabase(); | |
| } | |
| @Test | |
| public void testUpdateDoubleArrayProperty() throws Exception { | |
| db.beginTx(); | |
| Node node = db.createNode(); | |
| node.setProperty("foo", new double[]{0, 0, 0, 0}); | |
| AssertionError error=null; | |
| for (int i=0;i<100;i++) { | |
| double[] data= (double[]) node.getProperty("foo"); | |
| data[2]=i; | |
| data[3]=i; | |
| node.setProperty("foo", data); | |
| try { | |
| assertArrayEquals(new double[]{0, 0, i, i}, (double[])node.getProperty("foo"),0.1D); | |
| } catch(AssertionError ae) { | |
| System.out.println(ae.getMessage()); | |
| error=ae; | |
| } | |
| } | |
| if (error!=null) throw error; | |
| } | |
| @Test | |
| public void testSetDoubleArrayProperty() throws Exception { | |
| db.beginTx(); | |
| Node node = db.createNode(); | |
| AssertionError error=null; | |
| for (int i=0;i<100;i++) { | |
| node.setProperty("foo", new double[]{0, 0, i, i}); | |
| try { | |
| assertArrayEquals(new double[]{0, 0, i, i}, (double[])node.getProperty("foo"),0.1D); | |
| } catch(AssertionError ae) { | |
| System.out.println(ae.getMessage()); | |
| error=ae; | |
| } | |
| } | |
| if (error!=null) throw error; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment