Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CleanUpTest16, SurroundWithTests16 fails since I20250102-1800 #1899

Closed
jukzi opened this issue Jan 3, 2025 · 4 comments
Closed

CleanUpTest16, SurroundWithTests16 fails since I20250102-1800 #1899

jukzi opened this issue Jan 3, 2025 · 4 comments
Assignees
Labels
bug Something isn't working regression Regression defect test junit test related things
Milestone

Comments

@jukzi
Copy link
Contributor

jukzi commented Jan 3, 2025

CleanUpTest16 fails on all OS, locally reproducable
testOneIfWithPatternInstanceof
testPatternMatchingForInstanceof
testPatternMatchingForInstanceof2
image

for example
https://download.eclipse.org/eclipse/downloads/drops4/I20250102-1800/testresults/html/org.eclipse.jdt.ui.tests_ep435I-unit-macosx-x86_64-java21_macosx.cocoa.x86_64_21.html

org.opentest4j.AssertionFailedError: Content not as expected: is
package test1;

public class E {

protected String getString(Number number) {

if (number instanceof Long n) {
return n.toString();
}
if (number instanceof Float n) {
return n.toString();
}
if (number instanceof Double n) {
return n.toString();
}
if (number instanceof Float n && n.isInfinite()) {
return "Inf"; //$NON-NLS-1$
}
if (number instanceof Double m && m.isInfinite()) {
return "Inf"; //$NON-NLS-1$
}

return null;
}

}

Differs at pos 347: if (^number
expected:
package test1;

public class E {

protected String getString(Number number) {

if (number instanceof Long n) {
return n.toString();
}
if (number instanceof Float n) {
return n.toString();
}
if (number instanceof Double n) {
return n.toString();
}
if ((number instanceof Float n && n.isInfinite()) || (number instanceof Double m && m.isInfinite())) {
return "Inf"; //$NON-NLS-1$
}

return null;
}

}
==> expected: <package test1;

public class E {

protected String getString(Number number) {

if (number instanceof Long n) {
return n.toString();
}
if (number instanceof Float n) {
return n.toString();
}
if (number instanceof Double n) {
return n.toString();
}
if ((number instanceof Float n && n.isInfinite()) || (number instanceof Double m && m.isInfinite())) {
return "Inf"; //$NON-NLS-1$
}

return null;
}

}
> but was: <package test1;

public class E {

protected String getString(Number number) {

if (number instanceof Long n) {
return n.toString();
}
if (number instanceof Float n) {
return n.toString();
}
if (number instanceof Double n) {
return n.toString();
}
if (number instanceof Float n && n.isInfinite()) {
return "Inf"; //$NON-NLS-1$
}
if (number instanceof Double m && m.isInfinite()) {
return "Inf"; //$NON-NLS-1$
}

return null;
}

}
>
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
at org.eclipse.jdt.testplugin.StringAsserts.assertEqualString(StringAsserts.java:70)
at org.eclipse.jdt.testplugin.StringAsserts.assertEqualStringsIgnoreOrder(StringAsserts.java:122)
at org.eclipse.jdt.ui.tests.quickfix.QuickFixTest.assertEqualStringsIgnoreOrder(QuickFixTest.java:124)
at org.eclipse.jdt.ui.tests.quickfix.CleanUpTestCase.assertRefactoringResultAsExpected(CleanUpTestCase.java:192)
at org.eclipse.jdt.ui.tests.quickfix.CleanUpTest16.testOneIfWithPatternInstanceof(CleanUpTest16.java:404)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)

Could not find related commit (checked jdt.core jdt.ui platform.ui)

@jukzi jukzi added regression Regression defect test junit test related things labels Jan 3, 2025
@jukzi jukzi changed the title CleanUpTest16 fails since I20250102-1800 CleanUpTest16, SurroundWithTests16 fails since I20250102-1800 Jan 3, 2025
@jukzi
Copy link
Contributor Author

jukzi commented Jan 3, 2025

same for SurroundWithTests16
https://download.eclipse.org/eclipse/downloads/drops4/I20250102-1800/testresults/html/org.eclipse.jdt.ui.tests.refactoring_ep435I-unit-linux-x86_64-java23_linux.gtk.x86_64_23.html

org.junit.ComparisonFailure: expected:<...ion();
} /*]*/
[ System.out.println(x);
} catch (Exception e) {
}]

}
}> but was:<...ion();
} /*]*/
[} catch (Exception e) {
}
System.out.println(x);]

}
}>
at org.junit.Assert.assertEquals(Assert.java:117)
at org.eclipse.jdt.ui.tests.refactoring.GenericRefactoringTest.assertEqualLines(GenericRefactoringTest.java:648)
at org.eclipse.jdt.ui.tests.refactoring.GenericRefactoringTest.assertEqualLines(GenericRefactoringTest.java:632)
at org.eclipse.jdt.ui.tests.refactoring.infra.AbstractJunit4CUTestCase.compareSource(AbstractJunit4CUTestCase.java:95)
at org.eclipse.jdt.ui.tests.refactoring.infra.AbstractJunit4CUTestCase.compareSource(AbstractJunit4CUTestCase.java:87)
at org.eclipse.jdt.ui.tests.refactoring.AbstractJunit4SelectionTestCase.performTest(AbstractJunit4SelectionTestCase.java:141)
at org.eclipse.jdt.ui.tests.refactoring.SurroundWithTests.performTest(SurroundWithTests.java:53)
at org.eclipse.jdt.ui.tests.refactoring.SurroundWithTests16.tryCatchTest(SurroundWithTests16.java:58)
at org.eclipse.jdt.ui.tests.refactoring.SurroundWithTests16.testBug566949_1(SurroundWithTests16.java:63)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)

image

@jukzi
Copy link
Contributor Author

jukzi commented Jan 3, 2025

caused by eclipse-jdt/eclipse.jdt.core#3268, however a revert causes conflicts. @subyssurendran666

@subyssurendran666
Copy link

CleanUpTest16 fails on all OS, locally reproducable testOneIfWithPatternInstanceof testPatternMatchingForInstanceof testPatternMatchingForInstanceof2 image

for example https://download.eclipse.org/eclipse/downloads/drops4/I20250102-1800/testresults/html/org.eclipse.jdt.ui.tests_ep435I-unit-macosx-x86_64-java21_macosx.cocoa.x86_64_21.html

org.opentest4j.AssertionFailedError: Content not as expected: is
package test1;

public class E {

protected String getString(Number number) {

if (number instanceof Long n) {
return n.toString();
}
if (number instanceof Float n) {
return n.toString();
}
if (number instanceof Double n) {
return n.toString();
}
if (number instanceof Float n && n.isInfinite()) {
return "Inf"; //$NON-NLS-1$
}
if (number instanceof Double m && m.isInfinite()) {
return "Inf"; //$NON-NLS-1$
}

return null;
}

}

Differs at pos 347: if (^number
expected:
package test1;

public class E {

protected String getString(Number number) {

if (number instanceof Long n) {
return n.toString();
}
if (number instanceof Float n) {
return n.toString();
}
if (number instanceof Double n) {
return n.toString();
}
if ((number instanceof Float n && n.isInfinite()) || (number instanceof Double m && m.isInfinite())) {
return "Inf"; //$NON-NLS-1$
}

return null;
}

}
==> expected: <package test1;

public class E {

protected String getString(Number number) {

if (number instanceof Long n) {
return n.toString();
}
if (number instanceof Float n) {
return n.toString();
}
if (number instanceof Double n) {
return n.toString();
}
if ((number instanceof Float n && n.isInfinite()) || (number instanceof Double m && m.isInfinite())) {
return "Inf"; //$NON-NLS-1$
}

return null;
}

}
> but was: <package test1;

public class E {

protected String getString(Number number) {

if (number instanceof Long n) {
return n.toString();
}
if (number instanceof Float n) {
return n.toString();
}
if (number instanceof Double n) {
return n.toString();
}
if (number instanceof Float n && n.isInfinite()) {
return "Inf"; //$NON-NLS-1$
}
if (number instanceof Double m && m.isInfinite()) {
return "Inf"; //$NON-NLS-1$
}

return null;
}

}
>
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
at org.eclipse.jdt.testplugin.StringAsserts.assertEqualString(StringAsserts.java:70)
at org.eclipse.jdt.testplugin.StringAsserts.assertEqualStringsIgnoreOrder(StringAsserts.java:122)
at org.eclipse.jdt.ui.tests.quickfix.QuickFixTest.assertEqualStringsIgnoreOrder(QuickFixTest.java:124)
at org.eclipse.jdt.ui.tests.quickfix.CleanUpTestCase.assertRefactoringResultAsExpected(CleanUpTestCase.java:192)
at org.eclipse.jdt.ui.tests.quickfix.CleanUpTest16.testOneIfWithPatternInstanceof(CleanUpTest16.java:404)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)

Could not find related commit (checked jdt.core jdt.ui platform.ui)

I have tried to rewrite the following tests: testOneIfWithPatternInstanceof and testPatternMatchingForInstanceof2. However, they are not failing in JDT.Core. The Java 23 test should fail in JDT.UI since JDT.Core uses a new API, as mentioned in the respective GitHub issue. However, the Java 21 test, which uses older APIs, should work but is failing in JDT.UI.

@iloveeclipse
Copy link
Member

Should be fixed in the next I Build via eclipse-jdt/eclipse.jdt.core#3529.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Regression defect test junit test related things
Projects
None yet
Development

No branches or pull requests

3 participants