Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
- PointTypeIT wasn't cleaning up the database after tests
- missing nullcheck before checking isArray
  • Loading branch information
pontusmelke committed Oct 12, 2018
1 parent 24dd588 commit aab063a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Expand Up @@ -24,8 +24,6 @@


import org.neo4j.graphdb.PropertyContainer; import org.neo4j.graphdb.PropertyContainer;
import org.neo4j.graphdb.spatial.CRS; import org.neo4j.graphdb.spatial.CRS;
import org.neo4j.graphdb.spatial.Coordinate;
import org.neo4j.graphdb.spatial.Geometry;
import org.neo4j.graphdb.spatial.Point; import org.neo4j.graphdb.spatial.Point;
import org.neo4j.server.helpers.PropertyTypeDispatcher; import org.neo4j.server.helpers.PropertyTypeDispatcher;


Expand Down Expand Up @@ -78,7 +76,6 @@ protected Void dispatchBooleanProperty( boolean property, String param )
protected Void dispatchPointProperty( Point property, String param ) protected Void dispatchPointProperty( Point property, String param )
{ {
MappingWriter pointWriter = writer.newMapping( RepresentationType.POINT, param ); MappingWriter pointWriter = writer.newMapping( RepresentationType.POINT, param );

writePoint( pointWriter, property ); writePoint( pointWriter, property );
pointWriter.done(); pointWriter.done();
return null; return null;
Expand Down
Expand Up @@ -180,7 +180,7 @@ protected Representation dispatchFloatArrayProperty( PropertyArray<float[], Floa


@Override @Override
@SuppressWarnings( "boxing" ) @SuppressWarnings( "boxing" )
protected Representation dispatchDoubleArrayProperty( PropertyArray<double[], Double> array, String parfam ) protected Representation dispatchDoubleArrayProperty( PropertyArray<double[], Double> array, String param )
{ {
ArrayList<Representation> values = new ArrayList<>(); ArrayList<Representation> values = new ArrayList<>();
for ( Double z : array ) for ( Double z : array )
Expand Down
Expand Up @@ -139,7 +139,7 @@ else if ( value instanceof Temporal || value instanceof TemporalAmount )
{ {
super.writeValue( out, value.toString() ); super.writeValue( out, value.toString() );
} }
else if ( value.getClass().isArray() && supportedArrayType( value.getClass().getComponentType() ) ) else if ( value != null && value.getClass().isArray() && supportedArrayType( value.getClass().getComponentType() ) )
{ {
writeReflectiveArray( out, value ); writeReflectiveArray( out, value );
} }
Expand Down
Expand Up @@ -20,6 +20,7 @@
package org.neo4j.server.rest.transactional.integration; package org.neo4j.server.rest.transactional.integration;


import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.JsonNode;
import org.junit.After;
import org.junit.Test; import org.junit.Test;


import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Node;
Expand All @@ -44,10 +45,18 @@


public class PointTypeIT extends AbstractRestFunctionalTestBase public class PointTypeIT extends AbstractRestFunctionalTestBase
{ {
@After
public void tearDown()
{
// empty the database
graphdb().execute( "MATCH (n) DETACH DELETE n" );
}

@Test @Test
public void shouldWorkWithPoint2DArrays() throws Exception public void shouldWorkWithPoint2DArrays() throws Exception
{ {
HTTP.Response response = runQuery( "create (:Node {points: [point({x:1, y:1}), point({x:2, y:2}), point({x: 3.0, y: 3.0})]})" ); HTTP.Response response =
runQuery( "create (:Node {points: [point({x:1, y:1}), point({x:2, y:2}), point({x: 3.0, y: 3.0})]})" );


assertEquals( 200, response.status() ); assertEquals( 200, response.status() );
assertNoErrors( response ); assertNoErrors( response );
Expand Down

0 comments on commit aab063a

Please sign in to comment.