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

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

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

Assert.assertInstanceOf介绍

[英]Asserts that the given value is an instance of the given class. No tests are performed if the type is null. If the type is not-null but the value is null, this is considered as a failure.
[中]断言给定值是给定类的实例。如果类型为null,则不执行任何测试。如果类型不为null,但值为null,则视为失败。

代码示例

代码示例来源: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: apache/sis

/**
 * Tests increasing <var>x</var> values to increasing <var>y</var> values.
 *
 * @throws TransformException if an error occurred while testing a value.
 */
@Test
public void testIncreasingInputsToIncreasingValues() throws TransformException {
  preimage = new double[] { -207, -96, -5,   2};
  values   = new double[] {  -50, -20,  7, 105};
  verifyConsistency(-210, 5, 1941178068603334535L);
  assertInstanceOf("Expected y = f(x)", ConcatenatedTransformDirect1D.class, transform);
  assertInstanceOf("Expected y = f(x)", LinearInterpolator1D.class, ((ConcatenatedTransform) transform).transform2);
}

代码示例来源: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

/**
 * Tests {@link Java2D#createPolyline(int, Vector...)}.
 */
@Test
@Override
public void testCreatePolyline() {
  super.testCreatePolyline();
  assertInstanceOf("geometry", Path2D.class, geometry);
}

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

/**
 * Tests <var>x</var> values equal to indices and <var>y</var> values in increasing order.
 *
 * @throws TransformException if an error occurred while testing a value.
 */
@Test
public void testIndicesToIncreasingValues() throws TransformException {
  preimage = new double[] { 0,  1,  2,  3};
  values   = new double[] {10, 12, 16, 22};
  verifyConsistency(-2, 5, -5196528645359952958L);
  assertInstanceOf("Expected y=f(i)", LinearInterpolator1D.class, transform);
}

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

/**
 * Tests decreasing <var>x</var> values to increasing <var>y</var> values.
 *
 * @throws TransformException if an error occurred while testing a value.
 */
@Test
public void testDecreasingInputsToIncreasingValues() throws TransformException {
  preimage = new double[] {  2,  -5, -96, -207};
  values   = new double[] {-50, -20,  7,   105};
  verifyConsistency(-210, 5, 7360962930883142147L);
  assertInstanceOf("Expected y = -f(-x)", ConcatenatedTransformDirect1D.class, transform);
}

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

/**
 * Tests decreasing <var>x</var> values to decreasing <var>y</var> values.
 *
 * @throws TransformException if an error occurred while testing a value.
 */
@Test
public void testDecreasingInputsToDecreasingValues() throws TransformException {
  preimage = new double[] {  2, -5, -96, -207};
  values   = new double[] {105,  7, -19,  -43};
  verifyConsistency(-210, 5, -2463171263749789198L);
  assertInstanceOf("Expected y = -f(-x)", ConcatenatedTransformDirect1D.class, transform);
}

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

/**
 * Tests decreasing <var>x</var> values to <var>y</var> values that are equal to indices.
 *
 * @throws TransformException if an error occurred while testing a value.
 */
@Test
public void testDecreasingInputsToIndices() throws TransformException {
  preimage = new double[] {35, 27, 22, 5};
  values   = new double[] {0,   1,  2, 3};
  verifyConsistency(0, 40, 4109281798631024654L);
  assertInstanceOf("Expected i = -f(-x)", ConcatenatedTransformDirect1D.class, transform);
}

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

/**
   * Tests {@link Geometries#tryMergePolylines(Object, Iterator)}.
   */
  @Test
  @Override
  public void testTryMergePolylines() {
    super.testTryMergePolylines();
    assertInstanceOf("geometry", Path2D.class, geometry);
  }
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Every map projections shall be instances of {@link MathTransform2D}.
 * Note that some tests inherited from the parent class are not about
 * map projections.
 */
@After
public void ensureMathTransform2D() {
  final MathTransform tr = transform;
  if (tr != null && tr.getSourceDimensions() == 2 && tr.getTargetDimensions() == 2) {
    assertInstanceOf("Unexpected implementation.", MathTransform2D.class, tr);
  }
}

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

/**
 * Runs the GeoAPI tests, then perform implementation-specific checks.
 *
 * @throws FactoryException should never happen.
 * @throws TransformException should never happen.
 */
@Test
@Override
@Ignore(MESSAGE)
public void testIdentity3D() throws FactoryException, TransformException {
  super.testIdentity3D();
  assertInstanceOf("Unexpected implementation.", IdentityTransform.class, transform);
}

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

/**
 * Runs the GeoAPI tests, then perform implementation-specific checks.
 *
 * @throws FactoryException should never happen.
 * @throws TransformException should never happen.
 */
@Test
@Override
@Ignore(MESSAGE)
public void testAxisSwapping2D() throws FactoryException, TransformException {
  super.testAxisSwapping2D();
  assertInstanceOf("Unexpected implementation.", AffineTransform2D.class, transform);
}

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

/**
 * Runs the GeoAPI tests, then perform implementation-specific checks.
 *
 * @throws FactoryException should never happen.
 * @throws TransformException should never happen.
 */
@Test
@Override
@Ignore(MESSAGE)
public void testSouthOrientated2D() throws FactoryException, TransformException {
  super.testSouthOrientated2D();
  assertInstanceOf("Unexpected implementation.", AffineTransform2D.class, transform);
}

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

/**
 * Runs the GeoAPI tests, then perform implementation-specific checks.
 *
 * @throws FactoryException should never happen.
 * @throws TransformException should never happen.
 */
@Test
@Override
@Ignore(MESSAGE)
public void testGeneral() throws FactoryException, TransformException {
  super.testGeneral();
  assertInstanceOf("Unexpected implementation.", AffineTransform2D.class, transform);
}

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

/**
 * Runs the GeoAPI tests, then perform implementation-specific checks.
 *
 * @throws FactoryException should never happen.
 * @throws TransformException should never happen.
 */
@Test
@Override
@Ignore(MESSAGE)
public void testUniformScale2D() throws FactoryException, TransformException {
  super.testUniformScale2D();
  assertInstanceOf("Unexpected implementation.", AffineTransform2D.class, transform);
}

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

/**
 * Runs the GeoAPI tests, then perform implementation-specific checks.
 *
 * @throws FactoryException should never happen.
 * @throws TransformException should never happen.
 */
@Test
@Override
@Ignore(MESSAGE)
public void testRotation2D() throws FactoryException, TransformException {
  super.testRotation2D();
  assertInstanceOf("Unexpected implementation.", AffineTransform2D.class, transform);
}

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

/**
   * Runs the GeoAPI tests, then perform implementation-specific checks.
   *
   * @throws FactoryException should never happen.
   * @throws TransformException should never happen.
   */
  @Test
  @Override
  @Ignore(MESSAGE)
  public void testDimensionReduction() throws FactoryException, TransformException {
    super.testDimensionReduction();
    assertInstanceOf("Unexpected implementation.", ProjectiveTransform.class, transform);
  }
}

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

/**
 * Runs the GeoAPI tests, then perform implementation-specific checks.
 *
 * @throws FactoryException should never happen.
 * @throws TransformException should never happen.
 */
@Test
@Override
@Ignore(MESSAGE)
public void testTranslatation2D() throws FactoryException, TransformException {
  super.testTranslatation2D();
  assertInstanceOf("Unexpected implementation.", AffineTransform2D.class, transform);
}

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

/**
 * Runs the GeoAPI tests, then perform implementation-specific checks.
 *
 * @throws FactoryException should never happen.
 * @throws TransformException should never happen.
 */
@Test
@Override
@Ignore(MESSAGE)
public void testGenericScale2D() throws FactoryException, TransformException {
  super.testGenericScale2D();
  assertInstanceOf("Unexpected implementation.", AffineTransform2D.class, transform);
}

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

/**
   * Tests parsing a definition string with axes in kilometres.
   *
   * @throws FactoryException if the parsing failed.
   */
  @Test
  public void testKilometres() throws FactoryException {
    final Proj4Parser parser = new Proj4Parser("+proj=merc +to_meter=0.001");

    assertInstanceOf("method", Mercator1SP.class, parser.method(opFactory));
    final ParameterValueGroup pg = parser.parameters();
    assertEquals("scale_factor", pg.parameter("scale_factor").getValue(), 1.0);
    assertEquals(Units.KILOMETRE, parser.unit(false));
  }
}

相关文章