Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static java.nio.file.Files.isRegularFile;
import static java.nio.file.Files.newDirectoryStream;

import com.amazon.ion.IonException;
import com.amazon.ion.IonReader;
import com.amazon.ion.IonType;
import com.amazon.ion.IonWriter;
Expand Down Expand Up @@ -584,7 +585,7 @@ private void loadSession(Path session)
}
}
}
catch (IOException e)
catch (IOException | IonException e)
{
String msg = "Error reading coverage data at " + session;
throw new IOException(msg, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ void run(int expectedErrorCode, String... commandLine)
{
int errorCode = execute(commandLine);

assertEquals(expectedErrorCode, errorCode, "error code");

stdoutText = stdoutToString();
stderrText = stderrToString();

if (expectedErrorCode != errorCode)
{
dumpStdout();
dumpStderr();
}

assertEquals(expectedErrorCode, errorCode, "error code");
}

private int execute(String... commandLine)
Expand Down
5 changes: 5 additions & 0 deletions testing/src/main/java/dev/ionfusion/testing/Reflect.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package dev.ionfusion.testing;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.beans.IntrospectionException;
import java.beans.Introspector;
Expand Down Expand Up @@ -91,6 +92,10 @@ public static void assertEqualProperties(Object expected, Object actual)
if (prop.getName().equals("class")) continue;

Method readMethod = prop.getReadMethod();
assertNotNull(readMethod,
"No public getter for property " + prop.getName() +
" on " + expected.getClass().getName());

Object expectedPropertyValue = invoke(expected, readMethod);
Object actualPropertyValue = invoke(actual, readMethod);

Expand Down
15 changes: 15 additions & 0 deletions testing/src/main/java/dev/ionfusion/testing/StdioTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ protected String stderrToString()
}


protected void dumpStdout()
{
System.out.println("🔻stdout");
System.out.print(stdoutToString());
System.out.println("🔺stdout");
}

protected void dumpStderr()
{
System.out.println("🔻stderr");
System.out.print(stderrToString());
System.out.println("🔺stderr");
}


private String toString(ByteArrayOutputStream bytes)
{
try
Expand Down