Skip to content

Commit

Permalink
NbTestCase method ordering is always using "natural" order.
Browse files Browse the repository at this point in the history
 - disable tests
  • Loading branch information
mbien committed Jan 31, 2024
1 parent 8f0d8c6 commit 552f4f8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions harness/nbjunit/src/org/netbeans/junit/MethodOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ static void initialize() {
String orderS = findOrder();
if (!"natural".equals(orderS)) { // NOI18N
try {
// TODO: ClassLoader fields can not be accessed via reflection on JDK 12+
// see jdk.internal.reflect.Reflection#fieldFilterMap
// this won't work
Field classesF = ClassLoader.class.getDeclaredField("classes"); // NOI18N
classesF.setAccessible(true);
@SuppressWarnings("unchecked")
Expand All @@ -53,6 +56,7 @@ static void initialize() {
}
}
} catch (Exception x) {
System.err.println("WARNING: test method ordering disabled");
x.printStackTrace();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import junit.framework.TestResult;
import junit.framework.TestSuite;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

/** Check the a-z behaviour.
Expand All @@ -33,6 +34,8 @@ public class OrderAZTest {
System.setProperty("NbTestCase.order", "a-z");
}

// method order isn't working, see comment in org.netbeans.junit.MethodOrder
@Ignore
@Test public void shuffleTest() throws ClassNotFoundException {
Class<?> load = Class.forName("org.netbeans.junit.OrderHid");
TestSuite ts = new TestSuite(load);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class OrderTest {
static {
System.setProperty("NbTestCase.order", "1314372086210");
}

@Test public void shuffleTest() throws ClassNotFoundException {
Class<?> load = Class.forName("org.netbeans.junit.OrderHid");
TestSuite ts = new TestSuite(load);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import junit.framework.TestResult;
import junit.framework.TestSuite;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

/** Check the z-a behaviour.
Expand All @@ -33,6 +34,8 @@ public class OrderZATest {
System.setProperty("NbTestCase.order", "z-a");
}

// method order isn't working, see comment in org.netbeans.junit.MethodOrder
@Ignore
@Test public void shuffleTest() throws ClassNotFoundException {
Class<?> load = Class.forName("org.netbeans.junit.OrderHid");
TestSuite ts = new TestSuite(load);
Expand Down

0 comments on commit 552f4f8

Please sign in to comment.