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

Edge case: junit5.StaticImports should respect existing assertEquals #459

Open
koppor opened this issue Jan 15, 2024 · 2 comments
Open

Edge case: junit5.StaticImports should respect existing assertEquals #459

koppor opened this issue Jan 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@koppor
Copy link
Contributor

koppor commented Jan 15, 2024

    public static void assertEquals(List<Text> expected, List<Text> actual) {
        // Need to compare string values since Texts with the same string are not considered equal
        Assertions.assertEquals(expected.toString(), actual.toString());
        assertEquals(expected.toString(), actual.toString());

Assertions.assertEquals is rewritten to assertEquals (with a static import), which does not compile.

java: incompatible types: java.lang.String cannot be converted to java.util.List<javafx.scene.text.Text>

OK, this is an edge case. I will rename the method. Just want to bring it up if you are interested.

@koppor koppor added the bug Something isn't working label Jan 15, 2024
@koppor
Copy link
Contributor Author

koppor commented Jan 15, 2024

Maybe, I need it a little bit more for my test cases

    /**
     * Reads a bibtex database from the given InputStream. The list is compared with the given list.
     *
     * @param expectedInputStream the inputStream reading the entry from
     * @param actualEntries       a list containing a single entry to compare with
     */
    public static void assertEquals(InputStream expectedInputStream, List<BibEntry> actualEntries)
            throws IOException {
        assertNotNull(expectedInputStream);
        assertNotNull(actualEntries);
        // explicit reference of Assertions is needed here to disambiguate from the methods defined by this class
        List<BibEntry> expectedEntries = getListFromInputStream(expectedInputStream);
        Assertions.assertEquals(expectedEntries, actualEntries);
    }

@koppor
Copy link
Contributor Author

koppor commented Jan 15, 2024

Related issue #258 - but not a duplicate, because the recipe is another one here.

@koppor koppor closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2024
@koppor koppor reopened this Jan 15, 2024
@github-project-automation github-project-automation bot moved this from Done to In Progress in OpenRewrite Jan 15, 2024
@timtebeek timtebeek moved this from In Progress to Backlog in OpenRewrite Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

1 participant