aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-25 13:48:36 +0100
committerSven Gothel <[email protected]>2015-03-25 13:48:36 +0100
commit1608c8a7e616994ffb50339dbb2c5121c8060b53 (patch)
tree42c631b45f3d452ff845ca3b46c5b0e1033b84f4 /src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java
parent4f1561336f4867e97cd8a6ad05b883e2058556a3 (diff)
Unit Tests: Extend SingletonJunitCase and use deterministic test order
Diffstat (limited to 'src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java')
-rw-r--r--src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java b/src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java
index 2d612ce..84a0ff1 100644
--- a/src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java
+++ b/src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java
@@ -1,7 +1,13 @@
package com.jogamp.gluegen.jcpp;
import java.io.IOException;
+
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.junit.util.SingletonJunitCase;
+
import static com.jogamp.gluegen.jcpp.Token.*;
import static org.junit.Assert.*;
@@ -9,26 +15,27 @@ import static org.junit.Assert.*;
*
* @author shevek
*/
-public class NumericValueTest {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class NumericValueTest extends SingletonJunitCase {
- private Token testNumericValue(String in) throws IOException, LexerException {
- StringLexerSource s = new StringLexerSource(in);
+ private Token testNumericValue(final String in) throws IOException, LexerException {
+ final StringLexerSource s = new StringLexerSource(in);
- Token tok = s.token();
+ final Token tok = s.token();
System.out.println("Token is " + tok);
assertEquals(NUMBER, tok.getType());
- Token eof = s.token();
+ final Token eof = s.token();
assertEquals("Didn't get EOF, but " + tok, EOF, eof.getType());
return tok;
}
- private void testNumericValue(String in, double out) throws IOException, LexerException {
+ private void testNumericValue(final String in, final double out) throws IOException, LexerException {
System.out.println("Testing '" + in + "' -> " + out);
- Token tok = testNumericValue(in);
+ final Token tok = testNumericValue(in);
assertEquals(in, tok.getText());
- NumericValue value = (NumericValue) tok.getValue();
+ final NumericValue value = (NumericValue) tok.getValue();
assertEquals("Double mismatch", out, value.doubleValue(), 0.01d);
assertEquals("Float mismatch", (float) out, value.floatValue(), 0.01f);
assertEquals("Long mismatch", (long) out, value.longValue());
@@ -88,7 +95,7 @@ public class NumericValueTest {
try {
testNumericValue("097", 97);
fail("No warning.");
- } catch (LexerException e) {
+ } catch (final LexerException e) {
}
}