本文整理了Java中org.apache.sis.test.Assert.assertSame()
方法的一些代码示例,展示了Assert.assertSame()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertSame()
方法的具体详情如下:
包路径:org.apache.sis.test.Assert
类名称:Assert
方法名:assertSame
暂无
代码示例来源:origin: apache/sis
/**
* Asserts that the result of {@link EPSGFactoryFallback#createObject(String)} is the given prime meridian.
*/
private static void verifyCreatePrimeMeridian(final PrimeMeridian expected, final String code) throws FactoryException {
assertSame(code, expected, EPSGFactoryFallback.INSTANCE.createPrimeMeridian(code));
assertSame(code, expected, EPSGFactoryFallback.INSTANCE.createObject(code));
}
代码示例来源:origin: apache/sis
/**
* Asserts that the result of {@link EPSGFactoryFallback#createObject(String)} is the given ellipsoid.
*/
private static void verifyCreateEllipsoid(final Ellipsoid expected, final String code) throws FactoryException {
assertSame(code, expected, EPSGFactoryFallback.INSTANCE.createEllipsoid(code));
assertSame(code, expected, EPSGFactoryFallback.INSTANCE.createObject(code));
}
代码示例来源:origin: apache/sis
/**
* Asserts that the result of {@link EPSGFactoryFallback#createObject(String)} is the given datum.
*/
private static void verifyCreateDatum(final Datum expected, final String code) throws FactoryException {
assertSame(code, expected, EPSGFactoryFallback.INSTANCE.createDatum(code));
assertSame(code, expected, EPSGFactoryFallback.INSTANCE.createObject(code));
}
代码示例来源:origin: apache/sis
/**
* Tests serialization of pre-defined constants.
*/
@Test
public void testConstantSerialization() {
assertSame("SUPPORTED", SUPPORTED, assertSerializedEquals(SUPPORTED));
assertSame("UNSUPPORTED_STORAGE", UNSUPPORTED_STORAGE, assertSerializedEquals(UNSUPPORTED_STORAGE));
assertSame("INSUFFICIENT_BYTES", INSUFFICIENT_BYTES, assertSerializedEquals(INSUFFICIENT_BYTES));
assertSame("UNDETERMINED", UNDETERMINED, assertSerializedEquals(UNDETERMINED));
}
}
代码示例来源:origin: apache/sis
/**
* Tests {@link SystemUnit#divide(Unit)}.
*/
@Test
@DependsOnMethod("testEqualsAndHashCode")
public void testDivide() {
assertSame(Units.METRE, Units.METRE.divide(Units.UNITY));
assertSame(Units.METRE, Units.SQUARE_METRE.divide(Units.METRE));
assertSame(Units.METRE, Units.CUBIC_METRE.divide(Units.SQUARE_METRE));
assertSame(Units.SQUARE_METRE, Units.CUBIC_METRE.divide(Units.METRE));
assertSame(Units.METRES_PER_SECOND, Units.METRE.divide(Units.SECOND));
}
代码示例来源:origin: apache/sis
/**
* Tests {@link UnitDimension#divide(Dimension)}.
*/
@Test
@DependsOnMethod("testEqualsAndHashCode")
public void testDivide() {
assertSame(LENGTH, LENGTH.divide(DIMENSIONLESS));
assertSame(LENGTH, AREA .divide(LENGTH));
assertSame(LENGTH, VOLUME.divide(AREA));
assertSame(AREA, VOLUME.divide(LENGTH));
assertSame(SPEED, LENGTH.divide(TIME));
}
代码示例来源:origin: apache/sis
/**
* Serializes some units, deserializes them and verifies that we get the same instance.
*/
@Test
public void testSerialization() {
assertSame(Units.KILOMETRE, assertSerializedEquals(Units.KILOMETRE));
assertSame(Units.HECTARE, assertSerializedEquals(Units.HECTARE));
}
}
代码示例来源:origin: apache/sis
/**
* Serializes some units, deserializes them and verifies that we get the same instance.
*/
@Test
@DependsOnMethod("testEqualsAndHashCode")
public void testSerialization() {
assertSame(Units.METRE, assertSerializedEquals(Units.METRE));
assertSame(Units.SECOND, assertSerializedEquals(Units.SECOND));
assertSame(Units.NEWTON, assertSerializedEquals(Units.NEWTON));
assertSame(Units.UNITY, assertSerializedEquals(Units.UNITY));
}
代码示例来源:origin: apache/sis
/**
* Tests {@link SystemUnit#pow(int)}.
*/
@Test
@DependsOnMethod("testEqualsAndHashCode")
public void testPow() {
assertSame("UNITY", Units.UNITY, Units.UNITY.pow(4));
assertSame("SQUARE_METRE", Units.SQUARE_METRE, Units.METRE.pow(2));
assertSame("CUBIC_METRE", Units.CUBIC_METRE, Units.METRE.pow(3));
}
代码示例来源:origin: apache/sis
/**
* Tests {@link UnitDimension#pow(int)}.
*/
@Test
@DependsOnMethod("testEqualsAndHashCode")
public void testPow() {
assertSame("DIMENSIONLESS", DIMENSIONLESS, DIMENSIONLESS.pow(4));
assertSame("AREA", AREA, LENGTH.pow(2));
assertSame("VOLUME", VOLUME, LENGTH.pow(3));
}
代码示例来源:origin: apache/sis
/**
* Tests conversions to {@link Integer} values.
*/
@Test
public void testInteger() {
final ObjectConverter<Float, Integer> c = create(Float.class, Integer.class);
runInvertibleConversion(c, Float.valueOf(-8), Integer.valueOf(-8));
runConversion (c, Float.valueOf(2.25f), Integer.valueOf(2), Float.valueOf(2f));
runConversion (c, Float.valueOf(2.75f), Integer.valueOf(3), Float.valueOf(3f));
// Can not easily tests the values around Integer.MIN/MAX_VALUE because of rounding errors in float.
assertSame("Deserialization shall resolves to the singleton instance.", c, assertSerializedEquals(c));
}
代码示例来源:origin: apache/sis
/**
* Tests the search for a converter when the only available types are interfaces, and a most specific interface
* can be identified.
*/
@Test
public void testSourceInterface() {
final ObjectConverter<?,Integer> child = registerSourceInterfaces();
assertSame("Shall fallback on most specific interface.", child, registry.find(ArrayDeque.class, Integer.class));
assertSame("Shall fallback on most specific interface.", child, registry.find(ArrayDeque.class, Number.class));
}
}
代码示例来源:origin: apache/sis
/**
* Tests an instance having only the English locale.
*/
@Test
public void testEnglishOnly() {
final DefaultInternationalString toTest = new DefaultInternationalString();
toTest.add(Locale.ENGLISH, MESSAGE);
assertSame(MESSAGE, toTest.toString());
assertSame(MESSAGE, toTest.toString(null));
assertSame(MESSAGE, toTest.toString(Locale.ROOT));
validate(toTest);
}
代码示例来源:origin: apache/sis
/**
* Relax the requirements about {@link AbstractFeature#getProperty(String)} to return the exact same instance.
*/
@Override
boolean assertSameProperty(final String name, final Property expected, final boolean modified) {
final Property actual = (Property) feature.getProperty(name);
assertSame("name", expected.getName(), actual.getName());
if (!modified) {
assertSame("value", expected.getValue(), actual.getValue());
}
return actual == expected;
}
代码示例来源:origin: apache/sis
/**
* Tests conversions to {@link BigDecimal} values.
*/
@Test
public void testBigDecimal() {
final ObjectConverter<Double, BigDecimal> c = create(Double.class, BigDecimal.class);
runInvertibleConversion(c, Double.valueOf(2.5), BigDecimal.valueOf(2.5));
assertSame("Deserialization shall resolves to the singleton instance.", c, assertSerializedEquals(c));
}
代码示例来源:origin: apache/sis
/**
* Ensures that all converters tested so far are still registered.
*/
private void assertAllConvertersAreRegistered() {
for (final ObjectConverter<?,?> converter : converters) {
assertSame(converter, registry.find(converter.getSourceClass(), converter.getTargetClass()));
}
}
代码示例来源:origin: apache/sis
/**
* Verifies consistency of cached transforms when using translations inferred from {@link PixelOrientation}.
*/
@Test
public void testCache2D() {
assertSame(centerToCorner(2), centerToCorner2D());
assertSame(PixelTranslation.translate(MathTransforms.identity(2), PixelInCell.CELL_CORNER, PixelInCell.CELL_CENTER),
PixelTranslation.translate(MathTransforms.identity(2), PixelOrientation.UPPER_LEFT, PixelOrientation.CENTER, 0, 1));
}
}
代码示例来源:origin: apache/sis
/**
* Tests the creation of {@link CollectionConverter}.
*/
@Test
@SuppressWarnings("rawtypes")
public void testCollection() {
final ObjectConverter<Collection,List> c1 = INSTANCE.findExact(Collection.class, List.class);
assertInstanceOf("List ← Collection", CollectionConverter.class, c1);
assertSame(c1, assertSerializedEquals(c1));
}
}
代码示例来源:origin: apache/sis
/**
* Implementation of {@link #testIdentityTransform()} using the given CRS.
*/
private void testIdentityTransform(final CoordinateReferenceSystem crs) throws FactoryException {
final CoordinateOperation operation = finder.createOperation(crs, crs);
assertSame ("sourceCRS", crs, operation.getSourceCRS());
assertSame ("targetCRS", crs, operation.getTargetCRS());
assertTrue ("isIdentity", operation.getMathTransform().isIdentity());
assertTrue ("accuracy", operation.getCoordinateOperationAccuracy().isEmpty());
assertInstanceOf("operation", Conversion.class, operation);
finder = new CoordinateOperationFinder(null, factory, null); // Reset for next call.
}
代码示例来源:origin: apache/sis
/**
* Tests automatic creation of a converter for an array of values.
*/
@Test
public void testArrayOfWrapperTypes() {
register(new NumberConverter<>(Float.class, Double.class));
final ObjectConverter<?,?> converter = registry.find(Float[].class, Double[].class);
assertInstanceOf("Array conversions", ArrayConverter.class, converter);
assertEquals(Float [].class, converter.getSourceClass());
assertEquals(Double[].class, converter.getTargetClass());
assertSame("Converter shall be cached.", converter, registry.find(Float[].class, Double[].class));
}
内容来源于网络,如有侵权,请联系作者删除!