mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added programmatic access to BuildID and Version through methods on FModel.getBuildInfo().
- Added class forge.model.BuildInfo with unit test. - Added unit test for forge.model.FModel. - Added exception class forge.model.MultipleForgeJarsFoundError. - Updated forge.view.swing.Main with some preliminary code for progress monitoring. - Reduced CheckStyle, FindBugs, and PMD violations in these files and in net.slightlymagic.braids.util.testng.BraidsAssertFunctions. - Added missing package-info in net.slightlymagic.braids.util.testng.
This commit is contained in:
@@ -1,41 +1,42 @@
|
||||
package net.slightlymagic.braids.util.testng;
|
||||
|
||||
import net.slightlymagic.braids.util.ClumsyRunnable;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* A collection of assert functions that go with TestNG.
|
||||
*/
|
||||
@Test(groups = {"UnitTest"})
|
||||
public class BraidsAssertFunctions {
|
||||
public final class BraidsAssertFunctions {
|
||||
|
||||
/** Do not instantiate.*/
|
||||
private BraidsAssertFunctions() {;}
|
||||
|
||||
/**
|
||||
* Assert that a function (ClumsyRunnable) throws the given exception, or
|
||||
* a subclass of it.
|
||||
*
|
||||
* @param exnClass the exception we expect
|
||||
* @param withScissors the code to run
|
||||
*/
|
||||
public static void assertThrowsException(
|
||||
@SuppressWarnings("rawtypes") Class exnClass,
|
||||
ClumsyRunnable withScissors)
|
||||
{
|
||||
try {
|
||||
withScissors.run();
|
||||
}
|
||||
catch (Exception exn) {
|
||||
if (!exnClass.isInstance(exn)) {
|
||||
Assert.fail("caught exception " + exn.getClass().getName() +
|
||||
", but expected " + exnClass.getName());
|
||||
}
|
||||
|
||||
return; //success
|
||||
}
|
||||
|
||||
Assert.fail("expected exception " + exnClass.getName() + ", but none was thrown");
|
||||
}
|
||||
/** Do not instantiate.*/
|
||||
private BraidsAssertFunctions() {
|
||||
//empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that a function (ClumsyRunnable) throws the given exception, or
|
||||
* a subclass of it.
|
||||
*
|
||||
* @param exnClass the exception we expect
|
||||
* @param withScissors the code to run
|
||||
*/
|
||||
public static void assertThrowsException(
|
||||
@SuppressWarnings("rawtypes") final Class exnClass,
|
||||
final ClumsyRunnable withScissors)
|
||||
{
|
||||
try {
|
||||
withScissors.run();
|
||||
}
|
||||
catch (Exception exn) {
|
||||
if (!exnClass.isInstance(exn)) {
|
||||
Assert.fail("caught exception " + exn.getClass().getName()
|
||||
+ ", but expected " + exnClass.getName());
|
||||
}
|
||||
|
||||
return; //success
|
||||
}
|
||||
|
||||
Assert.fail("expected exception " + exnClass.getName() + ", but none was thrown");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
/** Utilities for TestNG tests. Licensed under both Apache 2.0 and GNU Public Licenses. */
|
||||
package net.slightlymagic.braids.util.testng;
|
||||
|
||||
Reference in New Issue
Block a user