diff options
Diffstat (limited to 'src/test/java/bjc/TestUtils.java')
| -rw-r--r-- | src/test/java/bjc/TestUtils.java | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/test/java/bjc/TestUtils.java b/src/test/java/bjc/TestUtils.java index c325877..17d6b7a 100644 --- a/src/test/java/bjc/TestUtils.java +++ b/src/test/java/bjc/TestUtils.java @@ -6,17 +6,17 @@ import static org.junit.Assert.*; /** * Utility methods for doing testing - * + * * @author Ben Culkin */ public class TestUtils { /** * Assert an iterator provides a particular sequence of values. - * + * * @param src - * The iterator to pull values from. + * The iterator to pull values from. * @param vals - * The values to expect from the iterator. + * The values to expect from the iterator. */ @SafeVarargs public static <T> void assertIteratorEquals(Iterator<T> src, T... vals) { @@ -24,9 +24,9 @@ public class TestUtils { if (src.hasNext()) { assertEquals(vals[i], src.next()); } else { - String msg = String.format("not enough values: got %d, wanted %d", - i, vals.length); - + String msg = String.format("not enough values: got %d, wanted %d", i, + vals.length); + assertTrue(msg, false); } } @@ -34,7 +34,7 @@ public class TestUtils { /** * Assert an iterator provides a particular sequence of values. - * + * * @param src * The iterator to pull values from. * @param hasMore @@ -43,14 +43,14 @@ public class TestUtils { * The values to expect from the iterator. */ @SafeVarargs - public static <T> void assertIteratorEquals(boolean hasMore, Iterator<T> src, T... vals) { + public static <T> void assertIteratorEquals(boolean hasMore, Iterator<T> src, + T... vals) { /* * @NOTE - * - * Even though it's awkward, the boolean has to come first. - * Otherwise, there are cases where the compiler will get - * confused as to what the right value for T is, and be unable - * to pick an overload. + * + * Even though it's awkward, the boolean has to come first. Otherwise, there are + * cases where the compiler will get confused as to what the right value for T + * is, and be unable to pick an overload. */ assertIteratorEquals(src, vals); @@ -59,35 +59,35 @@ public class TestUtils { /** * Assert an iterator provides a particular sequence of values. - * + * * @param src - * The iterator to pull values from. + * The iterator to pull values from. * @param vals - * The values to expect from the iterator. + * The values to expect from the iterator. */ @SafeVarargs public static <T> void assertIteratorSet(Iterator<T> src, T... vals) { Set<T> s1 = new HashSet<>(); Set<T> s2 = new HashSet<>(); - + for (int i = 0; i < vals.length; i++) { if (src.hasNext()) { s1.add(vals[i]); s2.add(src.next()); } else { - String msg = String.format("not enough values: got %d, wanted %d", - i, vals.length); - + String msg = String.format("not enough values: got %d, wanted %d", i, + vals.length); + assertTrue(msg, false); } } - + assertEquals(s1, s2); } /** * Assert an iterator provides a particular sequence of values. - * + * * @param src * The iterator to pull values from. * @param hasMore @@ -96,28 +96,28 @@ public class TestUtils { * The values to expect from the iterator. */ @SafeVarargs - public static <T> void assertIteratorSet(boolean hasMore, Iterator<T> src, T... vals) { + public static <T> void assertIteratorSet(boolean hasMore, Iterator<T> src, + T... vals) { /* * @NOTE - * - * Even though it's awkward, the boolean has to come first. - * Otherwise, there are cases where the compiler will get - * confused as to what the right value for T is, and be unable - * to pick an overload. + * + * Even though it's awkward, the boolean has to come first. Otherwise, there are + * cases where the compiler will get confused as to what the right value for T + * is, and be unable to pick an overload. */ assertIteratorSet(src, vals); assertEquals("iterator not exhausted", hasMore, src.hasNext()); } - + /** * Assert that a list contains a certain set of values. - * + * * @param src - * The list to read values from. - * + * The list to read values from. + * * @param exps - * The values to expect in the list. + * The values to expect in the list. */ @SafeVarargs public static <T> void assertListEquals(List<T> src, T... exps) { @@ -135,12 +135,12 @@ public class TestUtils { * Assert a stack has the given contents. * * @param <T> - * The type of items in the stack. + * The type of items in the stack. * * @param src - * The stack to inspect. + * The stack to inspect. * @param exps - * The values that are expected. + * The values that are expected. */ public static <T> void assertStackEquals(bjc.esodata.Stack<T> src, T... exps) { assertArrayEquals(exps, src.toArray()); |
