本文整理了Java中org.apache.sis.test.Assert.assertTrue()
方法的一些代码示例,展示了Assert.assertTrue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertTrue()
方法的具体详情如下:
包路径:org.apache.sis.test.Assert
类名称:Assert
方法名:assertTrue
暂无
代码示例来源:origin: apache/sis
/**
* Replaces the first occurrence of the given string by an other one.
*
* @param buffer the buffer in which to perform the replacement.
* @param toSearch the string to search.
* @param replaceBy the value to use as a replacement.
*/
private static void replace(final StringBuffer buffer, final String toSearch, final String replaceBy) {
final int i = buffer.indexOf(toSearch);
assertTrue("String to replace not found.", i >= 0);
buffer.replace(i, i+toSearch.length(), replaceBy);
}
代码示例来源:origin: apache/sis
/**
* Ensures that we can not element of the wrong type.
*/
@Test
public void testAddWrongType() {
final CheckedArrayList<String> list = new CheckedArrayList<>(String.class);
final String message = testAddWrongType(list);
assertTrue("element", message.contains("element"));
assertTrue("Integer", message.contains("Integer"));
assertTrue("String", message.contains("String"));
}
代码示例来源:origin: apache/sis
/**
* Verifies that the {@link Units#initialized} flag has been set.
*/
@Test
public void testInitialized() {
assertTrue(Units.initialized);
}
代码示例来源:origin: apache/sis
/**
* Tests the regular expression used for detecting the
* “Image courtesy of the U.S. Geological Survey” credit.
*/
@Test
public void testCreditPattern() {
final Matcher m = LandsatReader.CREDIT.matcher("Image courtesy of the U.S. Geological Survey");
assertTrue("matches", m.find());
assertEquals("end", 22, m.end());
}
代码示例来源:origin: apache/sis
/**
* Tests {@link CheckedArrayList#add(Object)}.
*/
@Test
public void testAdd() {
final CheckedArrayList<String> list = new CheckedArrayList<>(String.class);
assertTrue(list.add("One"));
assertTrue(list.add("Two"));
assertTrue(list.add("Three"));
assertEquals(Arrays.asList("One", "Two", "Three"), list);
}
代码示例来源:origin: apache/sis
/**
* Tests {@link ConventionalUnit#isCompatible(Unit)}.
*/
@Test
public void testIsCompatible() {
assertTrue (Units.KILOMETRE.isCompatible(Units.METRE));
assertFalse(Units.KILOMETRE.isCompatible(Units.SECOND));
assertTrue (Units.DEGREE .isCompatible(Units.GRAD));
assertTrue (Units.DEGREE .isCompatible(Units.PPM)); // Because those units are dimensionless.
}
代码示例来源:origin: apache/sis
/**
* Tests the {@link Range#contains(Comparable)} method without lower or upper endpoints.
*/
@Test
public void testContainsNoEndpoints() {
final Range<Integer> range = new Range<>(Integer.class, null, true, null, true);
assertTrue(range.contains(-55555));
assertTrue(range.contains(100000));
}
代码示例来源:origin: apache/sis
/**
* Tests {@link EllipsoidalHeightCombiner#properties(CoordinateReferenceSystem...)}.
*/
@Test
public void testProperties() {
final Map<String,?> properties = EllipsoidalHeightCombiner.properties(HardCodedCRS.WGS84, HardCodedCRS.GRAVITY_RELATED_HEIGHT, HardCodedCRS.TIME);
assertEquals("WGS 84 + MSL height + Time", properties.remove("name"));
assertEquals(Extents.WORLD, properties.remove("domainOfValidity"));
assertTrue("No other property expected.", properties.isEmpty());
}
}
代码示例来源:origin: apache/sis
/**
* Tests serialization.
*/
@Test
public void testSerialization() {
final RangeSet<Double> ranges = RangeSet.create(Double.class, true, false);
assertTrue(ranges.add(12.0, 12.5));
assertTrue(ranges.add(18.0, 18.5));
assertTrue(ranges.add(19.0, 20.0));
assertNotSame(ranges, assertSerializedEquals(ranges));
}
代码示例来源:origin: apache/sis
/**
* Tries to convert an unconvertible value.
*/
private static void tryUnconvertibleValue(final ObjectConverter<String,?> c) {
try {
c.apply("他の言葉");
fail("Should not accept a text.");
} catch (UnconvertibleObjectException e) {
// This is the expected exception.
assertTrue(e.getMessage().contains("他の言葉"));
}
}
代码示例来源:origin: apache/sis
/**
* Tries to convert a value which is expected to fail.
*/
private static <S extends Number> void tryUnconvertibleValue(final ObjectConverter<S,?> c, final S source) {
try {
c.apply(source);
fail("Should not accept the value.");
} catch (UnconvertibleObjectException e) {
// This is the expected exception.
assertTrue(e.getMessage().contains(c.getTargetClass().getSimpleName()));
}
}
代码示例来源:origin: apache/sis
/**
* Tests the {@link Range#contains(Comparable)} method without lower endpoint.
*/
@Test
public void testContainsNoLowerEndpoint() {
final Range<Integer> range = new Range<>(Integer.class, null, true, 5, true);
assertTrue (range.contains(-555));
assertTrue (range.contains(5));
assertFalse(range.contains(6));
}
代码示例来源:origin: apache/sis
/**
* Tests the {@link Range#contains(Comparable)} method.
*/
@Test
public void testContains() {
final Range<Integer> range = new Range<>(Integer.class, 3, true, 5, true);
assertTrue (range.contains(4));
assertFalse(range.contains(6));
assertFalse(range.contains(2));
assertTrue (range.contains(3));
assertTrue (range.contains(5));
}
代码示例来源:origin: apache/sis
/**
* Tests the {@link Range#contains(Comparable)} method without upper endpoint.
*/
@Test
public void testContainsNoUpperEndpoint() {
final Range<Integer> range = new Range<>(Integer.class, 3, true, null, true);
assertFalse(range.contains(1));
assertTrue (range.contains(3));
assertTrue (range.contains(10000));
}
代码示例来源:origin: apache/sis
/**
* Asserts that the result of {@link CRS#forCode(String)} is the given CRS.
*/
private static void verifyForCode(final SingleCRS expected, final String code) throws FactoryException {
final CoordinateReferenceSystem actual = CRS.forCode(code);
assertTrue(code, Utilities.deepEquals(expected, actual, ComparisonMode.DEBUG));
if (!EPSGFactoryFallback.FORCE_HARDCODED) {
assertSame(code, expected, actual);
}
}
代码示例来源:origin: apache/sis
/**
* Verifies some global properties.
*/
@Test
public void verifyGlobalProperties() {
assertEquals("translationDimensions", 2, grid.getTranslationDimensions());
assertTrue("coordinateToGrid.isIdentity", grid.getCoordinateToGrid().isIdentity());
assertTrue("gridToTarget.isIdentity", grid.gridToTarget().isIdentity());
}
代码示例来源: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 the {@link Range#contains(Range)} method without upper endpoint.
*/
@Test
public void testContainsRangeNoUpperEndpoint() {
final Range<Integer> range = new Range<>(Integer.class, -2500, true, null, true);
final Range<Integer> inside = new Range<>(Integer.class, 17, true, 305, true);
assertTrue(range.contains(inside));
assertFalse(inside.contains(range));
}
代码示例来源:origin: apache/sis
/**
* Tests {@link DefaultFeatureType#equals(Object)}.
*/
@Test
@DependsOnMethod("testSimple")
public void testEquals() {
final DefaultFeatureType city = city();
assertTrue (city.equals(city()));
assertFalse(city.equals(capital()));
}
代码示例来源:origin: apache/sis
/**
* Tests {@link LinearConverter#create(Number, Number)}.
*/
@Test
public void testCreate() {
assertTrue(LinearConverter.create(null, null).isIdentity());
assertScale(3, 1, LinearConverter.create(3, 0));
assertScale(3, 2, LinearConverter.create(new Fraction(3, 2), null));
}
内容来源于网络,如有侵权,请联系作者删除!