Skip to content

Commit

Permalink
Fix various tests so that they can run on JDK 17
Browse files Browse the repository at this point in the history
fix CanProxyToLocalhostTest: Proxy#toString changed slightly

fix JavaCompletionTask121FeaturesTest: add Record to test data

fix ConvertToRecordPatternTest and ConvertToNestedRecordPatternTest

 - enforce parsable source level for hint tests
 - update record patern syntax in tests

Stabilize JS Test testIssue215777 by Matthias

 - split golden files into two

NbTestCase method ordering is always using "natural" order

 - ClassLoader fields can not be accessed via reflection on JDK 12+
 - test method ordering options are not used anywhere atm
 - disable tests

Co-authored-by: Matthias Bläsing <mblaesing@doppel-helix.eu>
  • Loading branch information
mbien and matthiasblaesing committed Feb 9, 2024
1 parent 08ced69 commit 596ba28
Show file tree
Hide file tree
Showing 18 changed files with 176 additions and 172 deletions.
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 @@ -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 shuffle behaviour.
Expand All @@ -32,7 +33,9 @@ public class OrderTest {
static {
System.setProperty("NbTestCase.order", "1314372086210");
}


// 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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Process
ProcessBuilder
ProcessHandle
Readable
Record
ReflectiveOperationException
Runnable
Runtime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Process
ProcessBuilder
ProcessHandle
Readable
Record
ReflectiveOperationException
Runnable
Runtime
Expand Down
Loading

0 comments on commit 596ba28

Please sign in to comment.