org.opengis.test.Assert.assertEquals()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(185)

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

Assert.assertEquals介绍

暂无

代码示例

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

/**
 * Asserts that the given point is equals to the given value.
 */
private static void assertPointEquals(final double x, final double y, final Point2D point) {
  assertEquals(x, point.getX(), EPS);
  assertEquals(y, point.getY(), EPS);
}

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

/**
 * Checks if a {@link Comparable} is a number identical to the supplied float value.
 */
private static void assertBoundEquals(final String message, final double expected, final Comparable<?> actual) {
  assertInstanceOf(message, Double.class, actual);
  final double value = ((Number) actual).doubleValue();
  if (Double.isNaN(expected)) {
    assertEquals(message, Double.doubleToRawLongBits(expected), Double.doubleToRawLongBits(value));
  } else {
    assertEquals(message, expected, value, EPS);
  }
}

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

/**
 * Checks if a {@link Comparable} is a number identical to the supplied integer value.
 */
private static void assertBoundEquals(final String message, final int expected, final Comparable<?> actual) {
  assertInstanceOf(message, Integer.class, actual);
  assertEquals(message, expected, ((Number) actual).intValue());
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Asserts that the given datum has the expected name.
 *
 * @param datum  the datum to verify.
 * @param name   the string representation of the expected name (ignoring code space).
 */
private static void verifyDatum(final Datum datum, final String name) {
  assertNotNull("SingleCRS.getDatum()", datum);
  assertEquals("datum.getName().getCode()", name, datum.getName().getCode());
}

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

/**
 * Tests the examples given in {@code Types.getListName(ControlledVocabulary)} javadoc.
 */
@Test
public void testGetListName() {
  assertEquals("CS_AxisDirection",        Types.getListName(AxisDirection     .NORTH));
  assertEquals("CI_OnLineFunctionCode",   Types.getListName(OnLineFunction    .DOWNLOAD));
  assertEquals("MD_ImagingConditionCode", Types.getListName(ImagingCondition  .BLURRED_IMAGE));
}

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

/**
 * Tests the examples given in {@code Types.getCodeLabel(ControlledVocabulary)} javadoc.
 */
@Test
public void testGetCodeLabel() {
  assertEquals("North",         Types.getCodeLabel(AxisDirection   .NORTH));
  assertEquals("Download",      Types.getCodeLabel(OnLineFunction  .DOWNLOAD));
  assertEquals("Blurred image", Types.getCodeLabel(ImagingCondition.BLURRED_IMAGE));
}

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

/**
 * Tests the {@link Types#getStandardName(Class)} method.
 */
@Test
public void testGetStandardName() {
  assertEquals("CI_Citation",      Types.getStandardName(Citation     .class));
  assertEquals("CD_Datum",         Types.getStandardName(Datum        .class));
  assertEquals("CS_AxisDirection", Types.getStandardName(AxisDirection.class));
}

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

/**
 * Tests the examples given in {@code Types.getCodeName(ControlledVocabulary)} javadoc.
 */
@Test
public void testGetCodeName() {
  assertEquals("north",        Types.getCodeName(AxisDirection     .NORTH));
  assertEquals("download",     Types.getCodeName(OnLineFunction    .DOWNLOAD));
  assertEquals("blurredImage", Types.getCodeName(ImagingCondition  .BLURRED_IMAGE));
}

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

/**
 * Tests a vector backed by an array of strings.
 * This is not recommended, but happen in GDAL extensions of GeoTIFF.
 * See {@code org.apache.sis.storage.geotiff.Type.ASCII}.
 */
@Test
public void testStringArray() {
  vector = Vector.create(new String[] {"100", "80", "-20"}, false);
  assertEquals(  3, vector.size());
  assertEquals(100, vector.intValue(0));
  assertEquals( 80, vector.shortValue(1));
  assertEquals(-20, vector.doubleValue(2), STRICT);
}

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

/**
 * Tests the {@link Types#forStandardName(String)} method.
 */
@Test
public void testForStandardName() {
  assertEquals(Citation     .class, Types.forStandardName("CI_Citation"));
  assertEquals(Datum        .class, Types.forStandardName("CD_Datum"));
  assertEquals(Citation     .class, Types.forStandardName("CI_Citation"));            // Value should be cached.
  assertEquals(Citation     .class, Types.forStandardName("Citation"));
  assertEquals(AxisDirection.class, Types.forStandardName("CS_AxisDirection"));
  assertNull  (                     Types.forStandardName("MD_Dummy"));
}

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

/**
 * Tests the {@code Types.getDescription(ControlledVocabulary)} method.
 */
@Test
public void testGetCodeDescription() {
  final InternationalString description = Types.getDescription(OnLineFunction.DOWNLOAD);
  assertEquals("Online instructions for transferring data from one storage device or system to another.",
      description.toString(Locale.ROOT));
  assertEquals("Online instructions for transferring data from one storage device or system to another.",
      description.toString(Locale.ENGLISH));
  assertEquals("Transfert de la ressource d'un système à un autre.",
      description.toString(Locale.FRENCH));
}

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

/**
   * Asserts that the content of the given vector are equal.
   * The vectors do not need to use the same element type.
   */
  private static void assertContentEquals(final Vector expected, final Vector actual) {
    final int length = expected.size();
    assertEquals("size", length, actual.size());
    for (int i=0; i<length; i++) {
      assertEquals("value", expected.doubleValue(i), actual.doubleValue(i), STRICT);
    }
  }
}

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

/**
 * Tests {@link SequenceVector} with byte values.
 */
@Test
public void testSequenceOfBytes() {
  vector = Vector.createSequence(100, 2, 10);
  assertEquals(Integer.class, vector.getElementType());
  assertEquals(10, vector.size());
  for (int i=0; i<vector.size(); i++) {
    assertEquals(100 + 2*i, vector.byteValue(i));
  }
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Verifies the CRS name, datum and axis for {@code TIMECRS[“GPS Time”]}.
 */
private void verifyGPSTime(final TemporalCRS crs) {
  verifyIdentification   (crs, "GPS Time", null);
  verifyDatum            (crs.getDatum(), "Time origin");
  verifyCoordinateSystem (crs.getCoordinateSystem(), TimeCS.class, new AxisDirection[] {FUTURE}, units.day());
  assertEquals("TimeOrigin", new Date(315532800000L), crs.getDatum().getOrigin());
}

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

/**
 * Tests {@code Types.getCodeTitle(ControlledVocabulary)}.
 * Also opportunistically tests {@link Types#forCodeTitle(CharSequence)}.
 */
@Test
public void testGetCodeTitle() {
  final InternationalString title = Types.getCodeTitle(OnLineFunction.DOWNLOAD);
  assertSame("forCodeTitle", OnLineFunction.DOWNLOAD, Types.forCodeTitle(title));
  assertEquals("Download",       title.toString(Locale.ROOT));
  assertEquals("Download",       title.toString(Locale.ENGLISH));
  assertEquals("Téléchargement", title.toString(Locale.FRENCH));
}

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

/**
 * Tests the {@link Types#getDescription(Class, String)} method.
 */
@Test
public void testGetPropertyDescription() {
  assertEquals("The city of the location.",
      Types.getDescription(Address.class, "city").toString(Locale.ROOT));
  assertEquals("Country of the physical address.",
      Types.getDescription(Address.class, "country").toString(Locale.ENGLISH));
}

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

/**
 * Tests the {@link StorageConnector#getStorageName()} method.
 */
@Test
public void testGetStorageName() {
  final StorageConnector c = create(false);
  assertEquals(FILENAME, c.getStorageName());
}

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

/**
 * Tests the {@link StorageConnector#getFileExtension()} method.
 */
@Test
public void testGetExtension() {
  final StorageConnector c = create(false);
  assertEquals("txt", c.getFileExtension());
}

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

/**
 * Tests the {@link Types#getResources(String)} method.
 */
@Test
public void testGetResources() {
  assertEquals("org.opengis.metadata.Descriptions", Types.getResources("org.opengis.metadata.Identifier"));
  assertNull(Types.getResources("org.opengis.metadata2.Identifier"));
}

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

/**
 * Tests {@link Vector#reverse()}.
 */
@Test
@DependsOnMethod("testDoubleArray")
public void testReverse() {
  final double[] array    = {2, 3, 8};
  final double[] expected = {8, 3, 2};
  assertEquals(Vector.create(expected, false),
         Vector.create(array, false).reverse());
}

相关文章