use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class MonolineFormatterTest method testException.
/**
* Tests formatting a log record which contains an exception.
*/
@Test
@DependsOnMethod("testlevelWidth")
public void testException() {
final LogRecord record = new LogRecord(Level.WARNING, "An exception occured.");
final Exception exception = new Exception();
exception.setStackTrace(new StackTraceElement[] { new StackTraceElement("org.apache.sis.NonExistent", "foo", "NonExistent.java", 10), new StackTraceElement("org.junit.WhoKnows", "main", "WhoKnows.java", 20) });
record.setThrown(exception);
String formatted = formatter.format(record);
assertMultilinesEquals(localize(Level.WARNING, "WARNING\t An exception occured.\n" + "\t Caused by: java.lang.Exception\n" + "\t at org.apache.sis.NonExistent.foo(NonExistent.java:10)\n" + "\t at org.junit.WhoKnows.main(WhoKnows.java:20)\n"), formatted);
/*
* Remove the message and try again.
*/
record.setMessage(null);
formatted = formatter.format(record);
assertMultilinesEquals(localize(Level.WARNING, "WARNING\t java.lang.Exception\n" + "\t at org.apache.sis.NonExistent.foo(NonExistent.java:10)\n" + "\t at org.junit.WhoKnows.main(WhoKnows.java:20)\n"), formatted);
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class IndexedResourceBundleTest method testList.
/**
* Tests the {@link IndexedResourceBundle#list(Appendable)} method.
*
* @throws IOException should never happen since this test writes only in memory.
*/
@Test
@DependsOnMethod("testGetResources")
public void testList() throws IOException {
final StringBuilder buffer = new StringBuilder(4096);
Errors.getResources(Locale.ENGLISH).list(buffer);
final String text = buffer.toString();
final int key = text.indexOf("NullArgument_1");
final int value = text.indexOf("Argument ‘{0}’ shall not be null.");
assertTrue(key > 0);
assertTrue(value > key);
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class IndexedResourceBundleTest method testGetKeys.
/**
* Tests the {@link IndexedResourceBundle#getKeys()} method.
*/
@Test
@DependsOnMethod("testGetResources")
public void testGetKeys() {
testing = Errors.getResources(Locale.ENGLISH);
final Enumeration<String> e = testing.getKeys();
int count = 0;
boolean foundNullArgument_1 = false;
while (e.hasMoreElements()) {
final String key = e.nextElement();
if (key.equals("NullArgument_1")) {
foundNullArgument_1 = true;
}
count++;
}
assertTrue("foundNullArgument_1:", foundNullArgument_1);
assertTrue("count > 5", count > 5);
testing = null;
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class GeoKeysTest method verifyProjectionNames.
/**
* Verifies that GeoTIFF projection aliases registered in the {@link org.apache.sis.internal.referencing.provider}
* package match the name of fields listed in {@link GeoIdentifiers} and that GeoTIFF numerical codes correspond.
* This method verifies only projection names and identifiers, not parameter names.
*/
@Test
@DependsOnMethod("testName")
public void verifyProjectionNames() {
final MathTransformFactory factory = DefaultFactories.forBuildin(MathTransformFactory.class);
for (final OperationMethod method : factory.getAvailableMethods(SingleOperation.class)) {
final Identifier identifier = IdentifiedObjects.getIdentifier(method, Citations.GEOTIFF);
final Set<String> names = IdentifiedObjects.getNames(method, Citations.GEOTIFF);
/*
* If there is no GeoTIFF identifiers, we should have no GeoTIFF name neither.
* However we may have more than one name, since GeoTIFF defines also aliases.
*/
assertEquals(method.getName().getCode(), identifier == null, names.isEmpty());
if (identifier != null) {
final int code = Short.parseShort(identifier.getCode());
for (final String name : names) {
assertEquals(name, code, GeoIdentifiers.code(name));
}
}
}
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class MetadataCommandTest method testFormatXML.
/**
* Tests with the same file than {@link #testNetCDF()}, but producing a XML output.
*
* @throws Exception if an error occurred while creating the command.
*/
@Test
@Ignore("Requires GeoAPI 3.1")
@DependsOnMethod("testNetCDF")
public void testFormatXML() throws Exception {
final URL url = MetadataCommandTest.class.getResource("NCEP-SST.nc");
final MetadataCommand test = new MetadataCommand(0, CommandRunner.TEST, url.toString(), "--format", "XML");
test.run();
verifyNetCDF("<?xml", test.outputBuffer.toString());
}
Aggregations