com.vividsolutions.jts.util.Assert.equals()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中com.vividsolutions.jts.util.Assert.equals()方法的一些代码示例,展示了Assert.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.equals()方法的具体详情如下:
包路径:com.vividsolutions.jts.util.Assert
类名称:Assert
方法名:equals

Assert.equals介绍

[英]Throws an AssertionFailedException if the given objects are not equal, according to the equals method.
[中]根据equals方法,如果给定对象不相等,则抛出AssertionFailedException

代码示例

代码示例来源:origin: com.vividsolutions/jts

/**
 *  Throws an <code>AssertionFailedException</code> if the given objects are
 *  not equal, according to the <code>equals</code> method.
 *
 *@param  expectedValue              the correct value
 *@param  actualValue                the value being checked
 *@throws  AssertionFailedException  if the two objects are not equal
 */
public static void equals(Object expectedValue, Object actualValue) {
 equals(expectedValue, actualValue, null);
}

代码示例来源:origin: com.vividsolutions/jts

/**
 *@param  vertices  the vertices of a linear ring, which may or may not be
 *      flattened (i.e. vertices collinear)
 *@return           the coordinates with unnecessary (collinear) vertices
 *      removed
 */
private Coordinate[] cleanRing(Coordinate[] original) {
 Assert.equals(original[0], original[original.length - 1]);
 ArrayList cleanedRing = new ArrayList();
 Coordinate previousDistinctCoordinate = null;
 for (int i = 0; i <= original.length - 2; i++) {
  Coordinate currentCoordinate = original[i];
  Coordinate nextCoordinate = original[i+1];
  if (currentCoordinate.equals(nextCoordinate)) {
   continue;
  }
  if (previousDistinctCoordinate != null
    && isBetween(previousDistinctCoordinate, currentCoordinate, nextCoordinate)) {
   continue;
  }
  cleanedRing.add(currentCoordinate);
  previousDistinctCoordinate = currentCoordinate;
 }
 cleanedRing.add(original[original.length - 1]);
 Coordinate[] cleanedRingCoordinates = new Coordinate[cleanedRing.size()];
 return (Coordinate[]) cleanedRing.toArray(cleanedRingCoordinates);
}

代码示例来源:origin: com.vividsolutions/jts-core

/**
 *  Throws an <code>AssertionFailedException</code> if the given objects are
 *  not equal, according to the <code>equals</code> method.
 *
 *@param  expectedValue              the correct value
 *@param  actualValue                the value being checked
 *@throws  AssertionFailedException  if the two objects are not equal
 */
public static void equals(Object expectedValue, Object actualValue) {
 equals(expectedValue, actualValue, null);
}

代码示例来源:origin: Impetus/Kundera

Assert.equals(cqlQuery, expectedQuery);
    emf, em, pu, PersonCassandra.class, 200);
expectedQuery = "SELECT * FROM \"PERSONCASSANDRA\" WHERE \"PERSON_NAME\" = 'ram and wwe' AND \"AGE\" = 10 LIMIT 200  ALLOW FILTERING";
Assert.equals(cqlQuery, expectedQuery);
    emf, em, pu, PersonCassandra.class, 200);
expectedQuery = "SELECT * FROM \"PERSONCASSANDRA\" WHERE \"PERSON_NAME\" = 'Like-==' LIMIT 200  ALLOW FILTERING";
Assert.equals(cqlQuery, expectedQuery);
    emf, em, pu, PersonCassandra.class, 200);
expectedQuery = "SELECT * FROM \"PERSONCASSANDRA\" WHERE \"PERSON_NAME\" = '==1' LIMIT 200  ALLOW FILTERING";
Assert.equals(cqlQuery, expectedQuery);
    emf, em, pu, PersonCassandra.class, 200);
expectedQuery = "SELECT * FROM \"PERSONCASSANDRA\" WHERE \"PERSON_NAME\" = 'in= NOT IN >=set >< <>' LIMIT 200  ALLOW FILTERING";
Assert.equals(cqlQuery, expectedQuery);
    emf, em, pu, PersonCassandra.class, 200);
expectedQuery = "SELECT * FROM \"PERSONCASSANDRA\" WHERE \"PERSON_NAME\" = 'in= between. >=set anand >< or <>' LIMIT 200  ALLOW FILTERING";
Assert.equals(cqlQuery, expectedQuery);

代码示例来源:origin: com.vividsolutions/jts-core

/**
 *@param  vertices  the vertices of a linear ring, which may or may not be
 *      flattened (i.e. vertices collinear)
 *@return           the coordinates with unnecessary (collinear) vertices
 *      removed
 */
private Coordinate[] cleanRing(Coordinate[] original) {
 Assert.equals(original[0], original[original.length - 1]);
 ArrayList cleanedRing = new ArrayList();
 Coordinate previousDistinctCoordinate = null;
 for (int i = 0; i <= original.length - 2; i++) {
  Coordinate currentCoordinate = original[i];
  Coordinate nextCoordinate = original[i+1];
  if (currentCoordinate.equals(nextCoordinate)) {
   continue;
  }
  if (previousDistinctCoordinate != null
    && isBetween(previousDistinctCoordinate, currentCoordinate, nextCoordinate)) {
   continue;
  }
  cleanedRing.add(currentCoordinate);
  previousDistinctCoordinate = currentCoordinate;
 }
 cleanedRing.add(original[original.length - 1]);
 Coordinate[] cleanedRingCoordinates = new Coordinate[cleanedRing.size()];
 return (Coordinate[]) cleanedRing.toArray(cleanedRingCoordinates);
}

代码示例来源:origin: org.orbisgis/h2gis

/**
 *@param  vertices  the vertices of a linear ring, which may or may not be
 *      flattened (i.e. vertices collinear)
 *@return           the coordinates with unnecessary (collinear) vertices
 *      removed
 */
private Coordinate[] cleanRing(Coordinate[] original) {
  Assert.equals(original[0], original[original.length - 1]);
  ArrayList cleanedRing = new ArrayList();
  Coordinate previousDistinctCoordinate = null;
  for (int i = 0; i <= original.length - 2; i++) {
    Coordinate currentCoordinate = original[i];
    Coordinate nextCoordinate = original[i+1];
    if (currentCoordinate.equals(nextCoordinate)) {
      continue;
    }
    if (previousDistinctCoordinate != null
        && isBetween(previousDistinctCoordinate, currentCoordinate, nextCoordinate)) {
      continue;
    }
    cleanedRing.add(currentCoordinate);
    previousDistinctCoordinate = currentCoordinate;
  }
  cleanedRing.add(original[original.length - 1]);
  Coordinate[] cleanedRingCoordinates = new Coordinate[cleanedRing.size()];
  return (Coordinate[]) cleanedRing.toArray(cleanedRingCoordinates);
}

代码示例来源:origin: org.orbisgis/h2gis-functions

/**
 *@param  vertices  the vertices of a linear ring, which may or may not be
 *      flattened (i.e. vertices collinear)
 *@return           the coordinates with unnecessary (collinear) vertices
 *      removed
 */
private Coordinate[] cleanRing(Coordinate[] original) {
  Assert.equals(original[0], original[original.length - 1]);
  ArrayList cleanedRing = new ArrayList();
  Coordinate previousDistinctCoordinate = null;
  for (int i = 0; i <= original.length - 2; i++) {
    Coordinate currentCoordinate = original[i];
    Coordinate nextCoordinate = original[i+1];
    if (currentCoordinate.equals(nextCoordinate)) {
      continue;
    }
    if (previousDistinctCoordinate != null
        && isBetween(previousDistinctCoordinate, currentCoordinate, nextCoordinate)) {
      continue;
    }
    cleanedRing.add(currentCoordinate);
    previousDistinctCoordinate = currentCoordinate;
  }
  cleanedRing.add(original[original.length - 1]);
  Coordinate[] cleanedRingCoordinates = new Coordinate[cleanedRing.size()];
  return (Coordinate[]) cleanedRing.toArray(cleanedRingCoordinates);
}

代码示例来源:origin: org.apache.atlas/atlas-repository

private void deletePropagatedClassificationExpectFail(AtlasEntity entity, AtlasClassification classification) {
  try {
    deletePropagatedClassification(entity, classification);
    fail();
  } catch (AtlasBaseException ex) {
    Assert.equals(ex.getAtlasErrorCode(), PROPAGATED_CLASSIFICATION_REMOVAL_NOT_SUPPORTED);
  }
}

代码示例来源:origin: apache/atlas

private void deletePropagatedClassificationExpectFail(AtlasEntity entity, AtlasClassification classification) {
  try {
    deletePropagatedClassification(entity, classification);
    fail();
  } catch (AtlasBaseException ex) {
    Assert.equals(ex.getAtlasErrorCode(), PROPAGATED_CLASSIFICATION_REMOVAL_NOT_SUPPORTED);
  }
}

代码示例来源:origin: NationalSecurityAgency/datawave

@Test
public void testCartesianProductOfFields2() {
  
  Set<String> recordedFields = new HashSet<>();
  CardinalityRecord cr = new CardinalityRecord(recordedFields, CardinalityRecord.DateType.DOCUMENT);
  
  Map<String,List<String>> valueMap = new HashMap<>();
  List<String> list1 = new ArrayList<>();
  list1.add("L1V1");
  list1.add("L1V2");
  list1.add("L1V3");
  list1.add("L1V4");
  valueMap.put("FIELD1", list1);
  List<String> results = cr.assembleValues("FIELD1", valueMap);
  
  int expectedSize = list1.size();
  Assert.equals(expectedSize, results.size());
}

代码示例来源:origin: NationalSecurityAgency/datawave

@Test
public void testCartesianProductOfFields1() {
  
  Set<String> recordedFields = new HashSet<>();
  CardinalityRecord cr = new CardinalityRecord(recordedFields, CardinalityRecord.DateType.DOCUMENT);
  
  Map<String,List<String>> valueMap = new HashMap<>();
  List<String> results = cr.assembleValues("FIELD1", valueMap);
  
  Assert.equals(0, results.size());
}

代码示例来源:origin: NationalSecurityAgency/datawave

@Test
public void testCartesianProductOfFields3() {
  
  Set<String> recordedFields = new HashSet<>();
  CardinalityRecord cr = new CardinalityRecord(recordedFields, CardinalityRecord.DateType.DOCUMENT);
  
  Map<String,List<String>> valueMap = new HashMap<>();
  List<String> list1 = new ArrayList<>();
  list1.add("L1V1");
  list1.add("L1V2");
  list1.add("L1V3");
  list1.add("L1V4");
  valueMap.put("FIELD1", list1);
  List<String> list2 = new ArrayList<>();
  list2.add("L2V1");
  list2.add("L2V2");
  list2.add("L2V3");
  list2.add("L2V4");
  valueMap.put("FIELD2", list2);
  List<String> results = cr.assembleValues("FIELD1|FIELD2", valueMap);
  
  int expectedSize = list1.size() * list2.size();
  Assert.equals(expectedSize, results.size());
}

代码示例来源:origin: com.vividsolutions/jts-core

/**
 * Insert an edge with the same origin after this one.
 * Assumes that the inserted edge is in the correct
 * position around the ring.
 * 
 * @param e the edge to insert (with same origin)
 */
private void insertAfter(HalfEdge e) {
 Assert.equals(orig, e.orig());
 HalfEdge save = oNext();
 sym.setNext(e);
 e.sym().setNext(save);
}

代码示例来源:origin: NationalSecurityAgency/datawave

Assert.equals(expectedSize, results.size());

代码示例来源:origin: osmlab/atlas

@Test
  public void testConversion()
  {
    final Polygon polygonA = new Polygon(Location.CROSSING_85_280, Location.CROSSING_85_17,
        Location.TEST_1, Location.TEST_5, Location.CROSSING_85_280);
    final byte[] wkb = this.converter.convert(polygonA);
    final Polygon polygonB = this.converter.backwardConvert(wkb);
    Assert.equals(polygonA, polygonB, "Input/output Polygon must be the same");
  }
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

/**
 * this is a simple test that puts 2 features in the objectDatabase then retrieves them. It
 * checks the correlation is correct.
 */
@Test
public void testBulkGet() {
  ObjectDatabase odb = mock(ObjectDatabase.class);
  RevFeature f1 = mock(RevFeature.class);
  when(f1.getId()).thenReturn(getOID(1));
  RevFeature f2 = mock(RevFeature.class);
  when(f2.getId()).thenReturn(getOID(2));
  when(odb.getAll(anyObject(), anyObject(), anyObject()))
      .thenReturn((Arrays.asList((RevObject) f1, (RevObject) f2)).iterator());
  BulkObjectDatabaseFeatureRetriever bulk = new BulkObjectDatabaseFeatureRetriever(odb);
  ObjectId metadataid = getOID(4);
  Node n1 = Node.create("name1", getOID(1), metadataid, TYPE.FEATURE, new Envelope());
  NodeRef nr1 = new NodeRef(n1, "testcase", metadataid);
  Node n2 = Node.create("name2", getOID(2), metadataid, TYPE.FEATURE, new Envelope());
  NodeRef nr2 = new NodeRef(n2, "testcase", metadataid);
  Iterator<FeatureInfo> it = bulk.apply(Arrays.asList(nr1, nr2));
  List<FeatureInfo> feats = Arrays.asList(it.next(), it.next());
  Assert.isTrue(feats.get(0).getFeatureTypeId() == metadataid);
  Assert.isTrue(feats.get(0).getName() .equals("name1"));
  Assert.equals(feats.get(0).getFeature().getId(), getOID(1));
  Assert.isTrue(feats.get(1).getFeatureTypeId() == metadataid);
  Assert.isTrue(feats.get(1).getName() .equals( "name2"));
  Assert.equals(feats.get(1).getFeature().getId(), getOID(2));
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

@Test
public void testIdenticalFeatureData() {
  ObjectDatabase odb = mock(ObjectDatabase.class);
  RevFeature f1 = mock(RevFeature.class);
  when(f1.getId()).thenReturn(getOID(1));
  when(odb.getAll(anyObject(), anyObject(), anyObject()))
      .thenReturn((Arrays.asList((RevObject) f1 )).iterator());
  BulkObjectDatabaseFeatureRetriever bulk = new BulkObjectDatabaseFeatureRetriever(odb);
  ObjectId metadataid = getOID(4);
  Node n1 = Node.create("name1", getOID(1), metadataid, TYPE.FEATURE, new Envelope());
  NodeRef nr1 = new NodeRef(n1, "testcase", metadataid);
  Node n2 = Node.create("name2", getOID(1), metadataid, TYPE.FEATURE, new Envelope());
  NodeRef nr2 = new NodeRef(n2, "testcase", metadataid);
  Iterator<FeatureInfo> it = bulk.apply(Arrays.asList(nr1, nr2));
  List<FeatureInfo> feats = Lists.newArrayList(it);
  Assert.isTrue(feats.size() == 2);
  Assert.isTrue(feats.get(0).getFeatureTypeId() == metadataid);
  Assert.isTrue(feats.get(0).getName() .equals("name1"));
  Assert.equals(feats.get(0).getFeature().getId(), getOID(1));
  Assert.isTrue(feats.get(1).getFeatureTypeId() == metadataid);
  Assert.isTrue(feats.get(1).getName() .equals( "name2"));
  Assert.equals(feats.get(1).getFeature().getId(), getOID(1));
}

相关文章