Created
May 31, 2024 13:14
-
-
Save MBoegers/9c805b9caa35144466d9f380ddbb40bd to your computer and use it in GitHub Desktop.
ShortenFullyQualifiedTypeReferences handling Annotations in FQN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShortenFullyQualifiedTypeReferencesTest implements RewriteTest { | |
@Override | |
public void defaults(RecipeSpec spec) { | |
spec.recipe(new ShortenFullyQualifiedTypeReferences()); | |
} | |
// ommitted | |
@Nested | |
class AtAtTheBeginning { | |
@Test | |
void overwrite() { | |
rewriteRun( | |
java( | |
""" | |
import java.sql.DatabaseMetaData; | |
import java.util.List; | |
import java.lang.annotation.*; | |
class TypeAnnotationTest { | |
@java.lang.Override | |
void test() {} | |
} | |
""", | |
""" | |
import java.sql.DatabaseMetaData; | |
import java.util.List; | |
import java.lang.annotation.*; | |
class TypeAnnotationTest { | |
@Override | |
void test() {} | |
} | |
""" | |
) | |
); | |
} | |
@Test | |
@Disabled | |
void notNull() { | |
rewriteRun( | |
java( | |
""" | |
import java.sql.DatabaseMetaData; | |
import java.util.List; | |
import java.lang.annotation.*; | |
class TypeAnnotationTest { | |
@org.jetbrains.annotations.NotNull | |
String test() {} | |
} | |
""", | |
""" | |
import org.jetbrains.annotations.NotNull; | |
import java.sql.DatabaseMetaData; | |
import java.util.List; | |
import java.lang.annotation.*; | |
class TypeAnnotationTest { | |
@NotNull | |
String test() {} | |
} | |
""" | |
) | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment