Closed algomaster99 closed 1 month ago
This PR is a reminder that even the simplest of problems can take a bit of your time :cry:
The only test that fails it is because of a diff UPDATE: TestCase to junit.framework.TestCase
. In the left version, TestCase
is imported using wildcard and in the right version, TestCase
is imported using its fully qualified name.
With JUnit4 in the classpath, gumtree-spoon resolves that TestCase
is same as junit.framework.TestCase
since junit.framework,TestCase
is an API from JUnit4. However, when we update the JUnit version, spoon model cannot infer the same. If we also include junit.junit:4.13.2
, the problem goes away, but I don't want to have dependencies to test resources in pom.xml
.
@MartinWitt @I-Al-Istannen, did you see such a bug when porting JUnit 4 to JUnit 5 in spoon?
@SirYwell do you have an idea about this?
So in one version the class can be resolved via reflections and in the other spoon uses the no-classpath mode to try to come up with something? I don't think we encountered that in the spoon tests.
But I don't see a way that allows us - while using wildcard imports - to resolve the class properly. I assume you either have to adjust the resources, or the test, or the dependencies.
one version the class can be resolved via reflections and in the other spoon uses the no-classpath mode
It seems we use Spoon in default mode as you can see here. Not sure how mode is changing and if it should. I will try isolating classes for gumtree-spoon diffs from the ones on classpath.
@monperrus the last few commits fix a failing test because of update in version. Reason: diff computation was taking the junit from classpath. Since it changed from 4 to 5, it caused a change in the diff.
Now, the test is rewritten to use MavenLauncher
so it is forced to use junit 4 regardless of what is in the classpath.
You can merge now.
Hold on. There are some spurious changes.
Well, let's just live with it. Those are IntelliJ defaults. I don't want to change them.
thanks @algomaster99
Fixes #227
I need to upgrade in order to write good tests. I could use https://github.com/MartinWitt/laughing-train for this problem, but I was not able to build it on my system :/
The refactoring was pretty straightforward. I changed import statements,
Ignore
is now calledDisabled
, andreason
argument is not the last - afterexpected
andactual
.