@Test public void testNullOperations() throws Exception { Value nullv = ValueFactory.createNullValue(); Value numv = ValueFactory.createValue(4d); Value strv = ValueFactory.createValue("s"); Value falsev = numv.less(numv); Value truev = numv.equals(numv); assertTrue(nullv.multiply(numv).isNull()); assertTrue(numv.multiply(nullv).isNull()); assertTrue(nullv.sum(numv).isNull()); assertTrue(numv.sum(nullv).isNull()); assertTrue(strv.matches(nullv).isNull()); assertTrue(nullv.matches(strv).isNull()); assertTrue(falsev.or(nullv).isNull()); assertTrue(nullv.or(falsev).isNull()); assertTrue(truev.and(nullv).isNull()); assertTrue(nullv.and(truev).isNull()); assertTrue(numv.greaterEqual(nullv).isNull()); assertTrue(numv.equals(nullv).isNull()); assertTrue(numv.notEquals(nullv).isNull()); assertTrue(numv.less(nullv).isNull()); assertTrue(numv.lessEqual(nullv).isNull()); assertTrue(nullv.greaterEqual(numv).isNull()); assertTrue(nullv.equals(numv).isNull()); assertTrue(nullv.notEquals(numv).isNull()); assertTrue(nullv.less(numv).isNull()); assertTrue(nullv.lessEqual(numv).isNull()); }
/** * @see * com.hardcode.gdbms.engine.instruction.Operations#equals(com.hardcode.gdbms.engine.values.Value) */ public Value equals(Value value) throws IncompatibleTypesException { if (value instanceof NullValue) { return ValueFactory.createValue(false); } return ValueFactory.createValue(this.value.equals(value.toString())); }
private GeoRaster checkRasterMetadataIO(GeoRaster grSource) { Value v = ValueFactory.createValue(grSource); Value v2 = ValueFactory.createValue(v.getType(), v.getBytes()); GeoRaster gr = v2.getAsRaster(); assertEquals(gr.getMetadata(), grSource.getMetadata()); return gr; }
/** * DOCUMENT ME! * * @throws IncompatibleTypesException DOCUMENT ME! */ @Test public void testStringValueEquals() throws IncompatibleTypesException { Value v1 = ValueFactory.createValue("hola"); Value v2 = ValueFactory.createValue("hola"); Value v3 = ValueFactory.createValue("holA"); assertTrue((v1.equals(v2)).getAsBoolean()); assertFalse((v1.equals(v3)).getAsBoolean()); assertFalse((v2.equals(v3)).getAsBoolean()); }
@Test public void testValueCollectionConversion() throws Exception { Value value = ValueFactory.createValue( new Value[] {ValueFactory.createValue(2d), ValueFactory.createValue("hello")}); Set<Integer> set = new HashSet<Integer>(); set.add(13); checkConversions(value, set); }
@Test public void testDecimalDigits() throws Exception { assertEquals(((NumericValue) ValueFactory.createValue(2.3d)).getDecimalDigitsCount(), 1); assertEquals(((NumericValue) ValueFactory.createValue(2d)).getDecimalDigitsCount(), 0); assertEquals(((NumericValue) ValueFactory.createValue(23)).getDecimalDigitsCount(), 0); assertEquals(((NumericValue) ValueFactory.createValue(2.030f)).getDecimalDigitsCount(), 2); assertEquals( ((NumericValue) ValueFactory.createValue(2.00000000002d)).getDecimalDigitsCount(), 11); }
@Test public void testBooleanComparisons() throws Exception { Value v1 = ValueFactory.createValue(true); Value v2 = ValueFactory.createValue(false); assertEquals(v1.compareTo(v1), 0); assertEquals(v2.compareTo(v2), 0); assertEquals(v1.compareTo(v2), 1); assertEquals(v2.compareTo(v1), -1); }
/** We must be able to transform specialized collections to GeometryCollectionValues */ @Test public void testGeometryCollectionConversions() throws Exception { Value val = ValueFactory.createValue( gf.createMultiPoint( new Coordinate[] {new Coordinate(0, 0, 0), new Coordinate(1, 2, 3)})); assertTrue(val instanceof DefaultMultiPointValue); Value val2 = val.toType(Type.GEOMETRYCOLLECTION); assertTrue(val2 instanceof DefaultGeometryCollectionValue); // Let's be sure it's not a GeometryCollection just thanks to the inheritance assertFalse(val2 instanceof DefaultMultiPointValue); val = ValueFactory.createValue( gf.createMultiLineString( new LineString[] { gf.createLineString( new Coordinate[] {new Coordinate(0, 0, 0), new Coordinate(4, 2, 3)}), gf.createLineString( new Coordinate[] {new Coordinate(5, 6, 9), new Coordinate(5, 7, 1)}) })); assertTrue(val instanceof DefaultMultiLineStringValue); val2 = val.toType(Type.GEOMETRYCOLLECTION); assertTrue(val2 instanceof DefaultGeometryCollectionValue); // Let's be sure it's not a GeometryCollection just thanks to the inheritance assertFalse(val2 instanceof DefaultMultiPointValue); val = ValueFactory.createValue( gf.createMultiPolygon( new Polygon[] { gf.createPolygon( gf.createLinearRing( new Coordinate[] { new Coordinate(0, 3, 0), new Coordinate(9, 0, 0), new Coordinate(8, 7, 0), new Coordinate(0, 3, 0) }), null), gf.createPolygon( gf.createLinearRing( new Coordinate[] { new Coordinate(10, 3, 0), new Coordinate(9, 0, 0), new Coordinate(8, 7, 0), new Coordinate(10, 3, 0) }), null) })); assertTrue(val instanceof DefaultMultiPolygonValue); val2 = val.toType(Type.GEOMETRYCOLLECTION); assertTrue(val2 instanceof DefaultGeometryCollectionValue); // Let's be sure it's not a GeometryCollection just thanks to the inheritance assertFalse(val2 instanceof DefaultMultiPointValue); }
@Test public void testValuesTypes() throws Exception { assertEquals(ValueFactory.createValue(false).getType(), Type.BOOLEAN); assertEquals(ValueFactory.createValue(new byte[] {2, 3}).getType(), Type.BINARY); assertEquals(ValueFactory.createValue(new Date()).getType(), Type.DATE); assertEquals(ValueFactory.createValue(3.0d).getType(), Type.DOUBLE); assertEquals(ValueFactory.createValue(3.5f).getType(), Type.FLOAT); assertEquals(ValueFactory.createValue(4).getType(), Type.INT); assertEquals(ValueFactory.createValue(4L).getType(), Type.LONG); assertEquals(ValueFactory.createValue("").getType(), Type.STRING); assertEquals(ValueFactory.createValue(new Time(1)).getType(), Type.TIME); assertEquals(ValueFactory.createValue(new Timestamp(1)).getType(), Type.TIMESTAMP); }
/** * Test created to check that we effectively retrieve a good representation of empty * multipolygons. indeed, a NullPointerException used to happen... * * @throws Exception */ @Test public void testGeometryCollectionStringRepresentation() throws Exception { GeometryCollection mp = gf.createMultiPolygon(new Polygon[] {}); Value val = ValueFactory.createValue(mp); String str = val.toString(); assertEquals(str, "MULTIPOLYGON EMPTY"); Polygon poly = gf.createPolygon(gf.createLinearRing(new Coordinate[] {}), new LinearRing[] {}); assertTrue(poly.isEmpty()); mp = gf.createMultiPolygon( new Polygon[] { poly, }); val = ValueFactory.createValue(mp); str = val.toString(); assertNotNull(str); Polygon polyBis = gf.createPolygon( gf.createLinearRing( new Coordinate[] { new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), new Coordinate(3, 4, 0), new Coordinate(0, 0, 0), }), new LinearRing[] {}); mp = gf.createMultiPolygon(new Polygon[] {poly, polyBis}); val = ValueFactory.createValue(mp); str = val.toString(); assertNotNull(str); GeometryCollection coll = gf.createGeometryCollection( new Geometry[] { gf.createPolygon(gf.createLinearRing(new Coordinate[] {}), new LinearRing[] {}), gf.createPolygon( gf.createLinearRing( new Coordinate[] { new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), new Coordinate(3, 4, 0), new Coordinate(0, 0, 0), }), new LinearRing[] {}) }); mp = gf.createGeometryCollection(new Geometry[] {poly, coll, polyBis}); val = ValueFactory.createValue(mp); str = val.toString(); assertNotNull(str); }
@Test public void testTimestampValueConversion() throws Exception { Value value = ValueFactory.createValue(new Timestamp(System.currentTimeMillis())); Set<Integer> set = new HashSet<Integer>(); set.add(12); checkConversions(value, set); }
@Test public void testStringValueConversion() throws Exception { Value value = ValueFactory.createValue("gdms"); Set<Integer> set = new HashSet<Integer>(); set.add(10); checkConversions(value, set); }
@Test public void testGeometryValueConversion() throws Exception { Value value = ValueFactory.createValue(Geometries.getMultiPoint3D()); Set<Integer> set = new HashSet<Integer>(); set.add(6); checkConversions(value, set); }
@Test public void testDateValueConversion() throws Exception { Value value = ValueFactory.createValue(new Date()); Set<Integer> set = new HashSet<Integer>(); set.add(3); checkConversions(value, set); }
@Test public void testBooleanValueConversion() throws Exception { Value value = ValueFactory.createValue(false); Set<Integer> set = new HashSet<Integer>(); set.add(1); checkConversions(value, set); }
@Test public void testBinaryValueConversion() throws Exception { Value binary = ValueFactory.createValue(new byte[] {3, 5, 7}); Set<Integer> set = new HashSet<Integer>(); set.add(0); checkConversions(binary, set); }
public ReferenceValue referenceArrayLoad(IntegerValue indexValue, ValueFactory valueFactory) { return type == null ? ValueFactory.REFERENCE_VALUE_NULL : !ClassUtil.isInternalArrayType(type) ? ValueFactory.REFERENCE_VALUE_JAVA_LANG_OBJECT_MAYBE_NULL : valueFactory.createValue(type.substring(1), referencedClass, true).referenceValue(); }
/** * @see * com.hardcode.gdbms.engine.instruction.Operations#lessEqual(com.hardcode.gdbms.engine.values.BooleanValue) */ public Value lessEqual(Value value) throws IncompatibleTypesException { if (value instanceof NullValue) { return ValueFactory.createValue(false); } return new BooleanValue(this.value.compareTo(value.toString()) <= 0); }
private Comparison stringComparisonConstraint( DynamicOperand operand, String valueOperandShouldBe, QueryObjectModelFactory qomFactory, ValueFactory valueFactory) throws RepositoryException { return qomFactory.comparison( operand, QueryObjectModelFactory.JCR_OPERATOR_EQUAL_TO, qomFactory.literal(valueFactory.createValue(valueOperandShouldBe, PropertyType.STRING))); }
@Test public void testShortValueConversion() throws Exception { Value value = ValueFactory.createValue(Short.MAX_VALUE); Set<Integer> set = new HashSet<Integer>(); set.add(2); set.add(4); set.add(5); set.add(7); set.add(8); set.add(9); checkConversions(value, set); }
@Test public void testNumericValueComparisons() throws Exception { Value v1 = ValueFactory.createValue(1); Value v2 = ValueFactory.createValue(18); Value v3 = ValueFactory.createValue(-5d); Value v4 = ValueFactory.createValue(100d); Value v5 = ValueFactory.createValue(18f); // same value assertEquals(v1.compareTo(v1), 0); // opposite comparisons assertEquals(v1.compareTo(v2), -1); assertEquals(v2.compareTo(v1), 1); // different types assertEquals(v1.compareTo(v3), 1); assertEquals(v2.compareTo(v4), -1); assertEquals(v2.compareTo(v5), 0); }
/** * @see com.hardcode.gdbms.engine.values.Operations#like(com.hardcode.gdbms.engine.values.Value) */ public Value like(Value value) throws IncompatibleTypesException { if (value instanceof NullValue) { return ValueFactory.createValue(false); } if (value instanceof StringValue) { String pattern = ((StringValue) value).getValue().replaceAll("%", ".*"); pattern = pattern.replaceAll("\\?", "."); return new BooleanValue(this.value.matches(pattern)); } else { throw new IncompatibleTypesException(); } }
@Test public void testArrayValue() throws Exception { Value[] v = new Value[7]; for (int i = 0; i < v.length; i++) { v[i] = ValueFactory.createValue(i); } ValueCollection av = ValueFactory.createValue(v); for (int i = 0; i < v.length; i++) { v[i] = ValueFactory.createValue(i); } ValueCollection av2 = ValueFactory.createValue(v); assertTrue((av.equals(av2)).getAsBoolean()); assertEquals(av.hashCode(), av2.hashCode()); for (int i = 0; i < 7; i++) { assertTrue((av.get(i).equals(ValueFactory.createValue(i))).getAsBoolean()); } }
@Test public void testTimeValuesComparisons() throws Exception { DateFormat dateInstance = new SimpleDateFormat("yyyy/MM/dd"); Value v1 = ValueFactory.createValue(dateInstance.parse("2002/11/21")); Value v2 = ValueFactory.createValue(dateInstance.parse("2010/01/11")); assertEquals(v1.compareTo(v1), 0); assertEquals(v1.compareTo(v2), -1); assertEquals(v2.compareTo(v1), 1); v1 = ValueFactory.createValue(Time.valueOf("18:01:59")); v2 = ValueFactory.createValue(Time.valueOf("23:00:05")); assertEquals(v1.compareTo(v1), 0); assertEquals(v1.compareTo(v2), -1); assertEquals(v2.compareTo(v1), 1); v1 = ValueFactory.createValue(Timestamp.valueOf("2002-11-21 18:01:59")); v2 = ValueFactory.createValue(Timestamp.valueOf("2010-01-11 23:00:05")); assertEquals(v1.compareTo(v1), 0); assertEquals(v1.compareTo(v2), -1); assertEquals(v2.compareTo(v1), 1); }
private void checkIO(Value v) throws IncompatibleTypesException { Value v2 = ValueFactory.createValue(v.getType(), v.getBytes()); assertTrue((v2.equals(v)).getAsBoolean()); }
@GET @Path("/{type}") @Produces({Utils.MEDIA_TYPE_APPLICATION_HAL_PLUS_JSON, MediaType.APPLICATION_JSON}) public Object getByType( @PathParam("workspace") String workspace, @PathParam("language") String language, @PathParam("type") String type, @QueryParam("nameContains") List<String> nameConstraints, @QueryParam("orderBy") String orderBy, @QueryParam("limit") int limit, @QueryParam("offset") int offset, @QueryParam("depth") int depth, @Context UriInfo context) { if (API.isQueryDisabled()) { APIExceptionMapper.LOGGER.debug("Types endpoint is disabled. Attempted query on " + type); return Response.status(Response.Status.NOT_FOUND).build(); } final String unescapedNodetype = Names.unescape(type); if (API.excludedNodeTypes.contains(unescapedNodetype)) { return Response.status(Response.Status.FORBIDDEN) .entity("'" + unescapedNodetype + "' is not available for querying.") .build(); } Session session = null; try { session = getSession(workspace, language); final QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory(); final ValueFactory valueFactory = session.getValueFactory(); final Selector selector = qomFactory.selector(unescapedNodetype, SELECTOR_NAME); // language constraint: either jcr:language doesn't exist or jcr:language is current language Constraint constraint = qomFactory.or( qomFactory.not(qomFactory.propertyExistence(SELECTOR_NAME, Constants.JCR_LANGUAGE)), stringComparisonConstraint( qomFactory.propertyValue(SELECTOR_NAME, Constants.JCR_LANGUAGE), language, qomFactory, valueFactory)); // if we have passed "nameContains" query parameters, only return nodes which name contains // the specified terms if (nameConstraints != null && !nameConstraints.isEmpty()) { for (String name : nameConstraints) { final Comparison likeConstraint = qomFactory.comparison( qomFactory.nodeLocalName(SELECTOR_NAME), QueryObjectModelFactory.JCR_OPERATOR_LIKE, qomFactory.literal( valueFactory.createValue("%" + name + "%", PropertyType.STRING))); constraint = qomFactory.and(constraint, likeConstraint); } } Ordering[] orderings = null; // ordering deactivated because it currently doesn't work, probably due to a bug in // QueryServiceImpl if (Utils.exists(orderBy)) { if ("desc".equalsIgnoreCase(orderBy)) { orderings = new Ordering[] {qomFactory.descending(qomFactory.nodeLocalName(SELECTOR_NAME))}; } else { orderings = new Ordering[] {qomFactory.ascending(qomFactory.nodeLocalName(SELECTOR_NAME))}; } } final QueryObjectModel query = qomFactory.createQuery( selector, constraint, orderings, new Column[] {qomFactory.column(SELECTOR_NAME, null, null)}); if (limit > 0) { query.setLimit(limit); } query.setOffset(offset); final QueryResult queryResult = query.execute(); final NodeIterator nodes = queryResult.getNodes(); final List<JSONNode> result = new LinkedList<JSONNode>(); final Filter filter = Utils.getFilter(context); while (nodes.hasNext()) { final Node resultNode = nodes.nextNode(); if (filter.acceptChild(resultNode)) { JSONNode node = getFactory().createNode(resultNode, filter, depth); result.add(node); } } return Response.ok(result).build(); } catch (Exception e) { throw new APIException(e); } finally { closeSession(session); } }
// // public void testValueConversion() throws Exception { // Value intValue = ValueFactory.createValue(3); // Value doubleValue = ValueFactory.createValue(3.5d); // Value stringValue = ValueFactory.createValue("12"); // Value boolStringValue = ValueFactory.createValue("false"); // Value booleanValue = ValueFactory.createValue(true); // long longValue = System.currentTimeMillis(); // Value timeValue = ValueFactory.createValue(new Time(longValue)); // Value dateValue = ValueFactory.createValue(new Date(longValue)); // // checkToString(intType, stringType, intValue); // checkToString(intType, doubleType, intValue); // checkToString(doubleType, stringType, doubleValue); // checkToString(stringType, intType, stringValue); // checkToString(stringType, booleanType, boolStringValue); // checkToString(booleanType, stringType, booleanValue); // // BooleanValue bv = dateValue.toType( // timeType.getTypeCode()).equals(timeValue); // assertTrue(bv.getAsBoolean()); // } // // private void checkToString(Type firstType, Type secondType, Value value) // throws IncompatibleTypesException { // Value newValue = value.toType(secondType.getTypeCode()).toType( // firstType.getTypeCode()); // assertEquals(( newValue,value)); // } @Test public void testValuesIO() throws Exception { Value v; v = ValueFactory.createValue(false); checkIO(v); v = ValueFactory.createValue(new byte[] {2, 3, 6}); checkIO(v); v = ValueFactory.createValue(new Date()); checkIO(v); v = ValueFactory.createValue((short) 32700); checkIO(v); v = ValueFactory.createValue(421359827); checkIO(v); v = ValueFactory.createValue(1080131636); checkIO(v); v = ValueFactory.createValue(3.0975525d); checkIO(v); v = ValueFactory.createValue(3.52345f); checkIO(v); v = ValueFactory.createValue(8223372036854780000L); checkIO(v); v = ValueFactory.createValue("asdg"); checkIO(v); v = ValueFactory.createValue(new Time(1)); checkIO(v); v = ValueFactory.createValue(new Timestamp(1)); checkIO(v); v = ValueFactory.createValue(new GeometryFactory().createPoint(new Coordinate(10, 10, 10))); checkIO(v); v = ValueFactory.createValue(new GeometryFactory().createPoint(new Coordinate(10, 10))); checkIO(v); }
/** Tests the NullValues operations */ @Test public void testNullValueOperations() throws Exception { Value n = ValueFactory.createNullValue(); ValueCollection b = ValueFactory.createValue(new Value[0]); assertTrue((b.equals(n)).isNull()); assertTrue(b.notEquals(n).isNull()); Value v = ValueFactory.createValue(true); v.and(n); v.or(n); // SQL UNKNOWN assertNull((v.equals(n)).getAsBoolean()); assertNull((v.notEquals(n)).getAsBoolean()); Value i = ValueFactory.createValue(1); i.equals(n); i.notEquals(n); assertTrue((i.less(n)).isNull()); assertTrue((i.lessEqual(n)).isNull()); assertTrue((i.greater(n)).isNull()); assertTrue((i.greaterEqual(n)).isNull()); Value s = ValueFactory.createValue("test"); assertTrue((s.equals(n)).isNull()); assertTrue((s.notEquals(n)).isNull()); assertTrue((s.less(n)).isNull()); assertTrue((s.lessEqual(n)).isNull()); assertTrue((s.greater(n)).isNull()); assertTrue((s.greaterEqual(n)).isNull()); s.matches(n); Value d = ValueFactory.createValue(new Date()); assertTrue((d.equals(n)).isNull()); assertTrue((d.notEquals(n)).isNull()); assertTrue((d.less(n)).isNull()); assertTrue((d.lessEqual(n)).isNull()); assertTrue((d.greater(n)).isNull()); assertTrue((d.greaterEqual(n)).isNull()); Value t = ValueFactory.createValue(new Time(12)); assertTrue((t.equals(n)).isNull()); assertTrue((t.notEquals(n)).isNull()); assertTrue((t.less(n)).isNull()); assertTrue((t.lessEqual(n)).isNull()); assertTrue((t.greater(n)).isNull()); assertTrue((t.greaterEqual(n)).isNull()); Value ts = ValueFactory.createValue(new Timestamp(12)); assertTrue((ts.equals(n)).isNull()); assertTrue((ts.notEquals(n)).isNull()); assertTrue((ts.less(n)).isNull()); assertTrue((ts.lessEqual(n)).isNull()); assertTrue((ts.greater(n)).isNull()); assertTrue((ts.greaterEqual(n)).isNull()); assertTrue((n.equals(n)).isNull()); assertTrue((n.notEquals(n)).isNull()); assertTrue((n.less(n)).isNull()); assertTrue((n.lessEqual(n)).isNull()); assertTrue((n.greater(n)).isNull()); assertTrue((n.greaterEqual(n)).isNull()); n.matches(n); }
@Test public void testValueCollectionComparisons() { ValueCollection v1 = ValueFactory.createValue( new Value[] {ValueFactory.createValue(18), ValueFactory.createValue("abc")}); ValueCollection v2 = ValueFactory.createValue( new Value[] {ValueFactory.createValue(18), ValueFactory.createValue("acc")}); ValueCollection v3 = ValueFactory.createValue( new Value[] {ValueFactory.createValue(19), ValueFactory.createValue("abc")}); ValueCollection v4 = ValueFactory.createValue( new Value[] {ValueFactory.createValue(-12), ValueFactory.createValue("abc")}); assertEquals(0, v1.compareTo(v1)); assertEquals(1, v2.compareTo(v1)); assertEquals(-1, v1.compareTo(v3)); assertEquals(1, v1.compareTo(v4)); assertTrue(v1.less(v2).getAsBoolean()); assertTrue(v2.lessEqual(v2).getAsBoolean()); assertTrue(v3.greater(v2).getAsBoolean()); assertTrue(v4.greaterEqual(v4).getAsBoolean()); assertTrue(v3.greaterEqual(v4).getAsBoolean()); }
@Test public void test3DGeoms() throws Exception { Coordinate[] coords2D = new Coordinate[] { new Coordinate(10, 10, 10), new Coordinate(40, 10, 10), new Coordinate(40, 40, 10), new Coordinate(10, 40, 10), new Coordinate(10, 10, 10), }; Coordinate[] coords3D = new Coordinate[] { new Coordinate(10, 10), new Coordinate(40, 10), new Coordinate(40, 40), new Coordinate(10, 40), new Coordinate(10, 10), }; Value p1 = ValueFactory.createValue(gf.createPoint(new Coordinate(10, 10, 10))); Value p2 = ValueFactory.createValue(gf.createPoint(new Coordinate(10, 10))); checkDifferent(p1, p2); LineString l1 = gf.createLineString(coords2D); p1 = ValueFactory.createValue(l1); LineString l2 = gf.createLineString(coords3D); p2 = ValueFactory.createValue(l2); checkDifferent(p1, p2); p1 = ValueFactory.createValue(gf.createMultiPoint(coords2D)); p2 = ValueFactory.createValue(gf.createMultiPoint(coords3D)); checkDifferent(p1, p2); Polygon pol1 = gf.createPolygon(gf.createLinearRing(coords2D), null); p1 = ValueFactory.createValue(pol1); Polygon pol2 = gf.createPolygon(gf.createLinearRing(coords3D), null); p2 = ValueFactory.createValue(pol2); checkDifferent(p1, p2); p1 = ValueFactory.createValue(gf.createMultiLineString(new LineString[] {l1})); p2 = ValueFactory.createValue(gf.createMultiLineString(new LineString[] {l2})); checkDifferent(p1, p2); p1 = ValueFactory.createValue(gf.createMultiPolygon(new Polygon[] {pol1})); p2 = ValueFactory.createValue(gf.createMultiPolygon(new Polygon[] {pol2})); checkDifferent(p1, p2); }