- 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:
Braids
2011-08-12 14:47:37 +00:00
parent d8c7e407c5
commit 10431c521e
9 changed files with 609 additions and 37 deletions

View File

@@ -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");
}
}

View File

@@ -0,0 +1,3 @@
/** Utilities for TestNG tests. Licensed under both Apache 2.0 and GNU Public Licenses. */
package net.slightlymagic.braids.util.testng;