aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2024-11-29 00:20:15 +0200
committerDecebal Suiu <decebal.suiu@gmail.com>2024-11-29 00:37:23 +0200
commit0e19e3a9bda015cfb472e72b1c4dfc81f86f8df3 (patch)
treee6296ca48ba7290caf5f43ef2877c8139b63308a
parent5afc98a7bdd8d866bbd4734140d69dcabef71d27 (diff)
downloadpf4j-0e19e3a9bda015cfb472e72b1c4dfc81f86f8df3.tar.gz
pf4j-0e19e3a9bda015cfb472e72b1c4dfc81f86f8df3.zip
Fix constant name
-rw-r--r--pf4j/src/test/java/org/pf4j/AbstractExtensionFinderTest.java10
-rw-r--r--pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java3
-rw-r--r--pf4j/src/test/java/org/pf4j/ExtensionAnnotationProcessorTest.java16
-rw-r--r--pf4j/src/test/java/org/pf4j/test/JavaSources.java4
4 files changed, 16 insertions, 17 deletions
diff --git a/pf4j/src/test/java/org/pf4j/AbstractExtensionFinderTest.java b/pf4j/src/test/java/org/pf4j/AbstractExtensionFinderTest.java
index a0ad300..4ac6e8a 100644
--- a/pf4j/src/test/java/org/pf4j/AbstractExtensionFinderTest.java
+++ b/pf4j/src/test/java/org/pf4j/AbstractExtensionFinderTest.java
@@ -254,24 +254,24 @@ class AbstractExtensionFinderTest {
@Test
void findExtensionAnnotation() {
- List<JavaFileObject> generatedFiles = JavaSources.compileAll(JavaSources.Greeting, JavaSources.WhazzupGreeting);
+ List<JavaFileObject> generatedFiles = JavaSources.compileAll(JavaSources.GREETING, JavaSources.WHAZZUP_GREETING);
assertEquals(2, generatedFiles.size());
Map<String, Class<?>> loadedClasses = new JavaFileObjectClassLoader().load(generatedFiles);
- Class<?> clazz = loadedClasses.get("test.WhazzupGreeting");
+ Class<?> clazz = loadedClasses.get(JavaSources.WHAZZUP_GREETING_CLASS_NAME);
Extension extension = AbstractExtensionFinder.findExtensionAnnotation(clazz);
Assertions.assertNotNull(extension);
}
@Test
void findExtensionAnnotationThatMissing() {
- List<JavaFileObject> generatedFiles = JavaSources.compileAll(JavaSources.Greeting,
+ List<JavaFileObject> generatedFiles = JavaSources.compileAll(JavaSources.GREETING,
ExtensionAnnotationProcessorTest.SpinnakerExtension_NoExtension,
ExtensionAnnotationProcessorTest.WhazzupGreeting_SpinnakerExtension);
assertEquals(3, generatedFiles.size());
Map<String, Class<?>> loadedClasses = new JavaFileObjectClassLoader().load(generatedFiles);
- Class<?> clazz = loadedClasses.get("test.WhazzupGreeting");
+ Class<?> clazz = loadedClasses.get(JavaSources.WHAZZUP_GREETING_CLASS_NAME);
Extension extension = AbstractExtensionFinder.findExtensionAnnotation(clazz);
Assertions.assertNull(extension);
}
@@ -300,7 +300,7 @@ class AbstractExtensionFinderTest {
};
- List<JavaFileObject> generatedFiles = JavaSources.compileAll(JavaSources.Greeting, JavaSources.WhazzupGreeting);
+ List<JavaFileObject> generatedFiles = JavaSources.compileAll(JavaSources.GREETING, JavaSources.WHAZZUP_GREETING);
assertEquals(2, generatedFiles.size());
Class<?> extensionPointClass = new JavaFileObjectClassLoader().load(generatedFiles).get(JavaSources.GREETING_CLASS_NAME);
Class<?> extensionClass = new JavaFileObjectClassLoader().load(generatedFiles).get(JavaSources.WHAZZUP_GREETING_CLASS_NAME);
diff --git a/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java b/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java
index bc31b84..0dd2650 100644
--- a/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java
+++ b/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java
@@ -42,7 +42,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import static org.pf4j.test.JavaSources.Greeting;
class DefaultPluginManagerTest {
@@ -441,7 +440,7 @@ class DefaultPluginManagerTest {
@Test
void unloadPlugin() throws IOException, ClassNotFoundException {
- JavaFileObject object = JavaSources.compile(Greeting);
+ JavaFileObject object = JavaSources.compile(JavaSources.GREETING);
String pluginClassName = JavaFileObjectUtils.getClassName(object);
byte[] pluginBytes = JavaFileObjectUtils.getAllBytes(object);
diff --git a/pf4j/src/test/java/org/pf4j/ExtensionAnnotationProcessorTest.java b/pf4j/src/test/java/org/pf4j/ExtensionAnnotationProcessorTest.java
index 2b3241d..289746b 100644
--- a/pf4j/src/test/java/org/pf4j/ExtensionAnnotationProcessorTest.java
+++ b/pf4j/src/test/java/org/pf4j/ExtensionAnnotationProcessorTest.java
@@ -125,7 +125,7 @@ public class ExtensionAnnotationProcessorTest {
@Test
public void options() {
Compilation compilation = compiler().withOptions("-Ab=2", "-Ac=3")
- .compile(JavaSources.Greeting, JavaSources.WhazzupGreeting);
+ .compile(JavaSources.GREETING, JavaSources.WHAZZUP_GREETING);
assertEquals(Compilation.Status.SUCCESS, compilation.status());
Map<String, String> options = new HashMap<>();
options.put("b", "2");
@@ -135,20 +135,20 @@ public class ExtensionAnnotationProcessorTest {
@Test
public void storage() {
- Compilation compilation = compile(JavaSources.Greeting, JavaSources.WhazzupGreeting);
+ Compilation compilation = compile(JavaSources.GREETING, JavaSources.WHAZZUP_GREETING);
assertEquals(Compilation.Status.SUCCESS, compilation.status());
assertEquals(annotationProcessor.getStorage().getClass(), LegacyExtensionStorage.class);
}
@Test
public void compileWithoutError() {
- Compilation compilation = compile(JavaSources.Greeting, JavaSources.WhazzupGreeting);
+ Compilation compilation = compile(JavaSources.GREETING, JavaSources.WHAZZUP_GREETING);
assertThat(compilation).succeededWithoutWarnings();
}
@Test
public void compileWithError() {
- Compilation compilation = compile(JavaSources.Greeting, WhazzupGreeting_NoExtensionPoint);
+ Compilation compilation = compile(JavaSources.GREETING, WhazzupGreeting_NoExtensionPoint);
assertThat(compilation).failed();
assertThat(compilation).hadErrorContaining("it doesn't implement ExtensionPoint")
.inFile(WhazzupGreeting_NoExtensionPoint)
@@ -158,19 +158,19 @@ public class ExtensionAnnotationProcessorTest {
@Test
public void getExtensions() {
- Compilation compilation = compile(JavaSources.Greeting, JavaSources.WhazzupGreeting);
+ Compilation compilation = compile(JavaSources.GREETING, JavaSources.WHAZZUP_GREETING);
assertThat(compilation).succeededWithoutWarnings();
Map<String, Set<String>> extensions = new HashMap<>();
- extensions.put("test.Greeting", new HashSet<>(Collections.singletonList("test.WhazzupGreeting")));
+ extensions.put(JavaSources.GREETING_CLASS_NAME, new HashSet<>(Collections.singletonList(JavaSources.WHAZZUP_GREETING_CLASS_NAME)));
assertEquals(extensions, annotationProcessor.getExtensions());
}
@Test
public void compileNestedExtensionAnnotation() {
- Compilation compilation = compile(JavaSources.Greeting, SpinnakerExtension, WhazzupGreeting_SpinnakerExtension);
+ Compilation compilation = compile(JavaSources.GREETING, SpinnakerExtension, WhazzupGreeting_SpinnakerExtension);
assertThat(compilation).succeededWithoutWarnings();
Map<String, Set<String>> extensions = new HashMap<>();
- extensions.put("test.Greeting", new HashSet<>(Collections.singletonList("test.WhazzupGreeting")));
+ extensions.put(JavaSources.GREETING_CLASS_NAME, new HashSet<>(Collections.singletonList(JavaSources.WHAZZUP_GREETING_CLASS_NAME)));
assertEquals(extensions, annotationProcessor.getExtensions());
}
diff --git a/pf4j/src/test/java/org/pf4j/test/JavaSources.java b/pf4j/src/test/java/org/pf4j/test/JavaSources.java
index e3b08fe..09fde1e 100644
--- a/pf4j/src/test/java/org/pf4j/test/JavaSources.java
+++ b/pf4j/src/test/java/org/pf4j/test/JavaSources.java
@@ -31,7 +31,7 @@ import static com.google.testing.compile.Compiler.javac;
public class JavaSources {
public static final String GREETING_CLASS_NAME = "test.Greeting";
- public static final JavaFileObject Greeting = JavaFileObjects.forSourceLines("Greeting",
+ public static final JavaFileObject GREETING = JavaFileObjects.forSourceLines("Greeting",
"package test;",
"import org.pf4j.ExtensionPoint;",
"",
@@ -40,7 +40,7 @@ public class JavaSources {
"}");
public static final String WHAZZUP_GREETING_CLASS_NAME = "test.WhazzupGreeting";
- public static final JavaFileObject WhazzupGreeting = JavaFileObjects.forSourceLines("WhazzupGreeting",
+ public static final JavaFileObject WHAZZUP_GREETING = JavaFileObjects.forSourceLines("WhazzupGreeting",
"package test;",
"import org.pf4j.Extension;",
"",