forked from AlmasB/FXGL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
10 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,11 @@ | |
import java.util.Map; | ||
|
||
/** | ||
* Helper class that allows injecting values into fields in test environments. | ||
* | ||
* @author Almas Baimagambetov ([email protected]) | ||
*/ | ||
public class InjectInTest { | ||
public final class InjectInTest { | ||
|
||
private InjectInTest() {} | ||
|
||
|
@@ -38,13 +40,13 @@ public static void inject(MethodHandles.Lookup lookup, Object instance, String f | |
} | ||
|
||
/** | ||
* Convenience method to mass inject multiple values | ||
* Convenience method to mass inject multiple values. | ||
* | ||
* @param lookup the lookup created by the module where class of instance lives | ||
* @param instance object to inject to | ||
* @param fieldsMap Map of field names of instances and values to inject | ||
* @param fieldsMap map of field names of instances and values to inject | ||
*/ | ||
public static void inject(MethodHandles.Lookup lookup, Object instance, Map<String, Object> fieldsMap) { | ||
fieldsMap | ||
.forEach((key, value) -> inject(lookup, instance, key, value)); | ||
fieldsMap.forEach((key, value) -> inject(lookup, instance, key, value)); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,9 @@ | |
import org.junit.jupiter.api.extension.ExtensionContext; | ||
|
||
/** | ||
* For tests that require JavaFX platform to be initialized. | ||
* Usage: @ExtendWith(RunWithFX.class) before the test class. | ||
* | ||
* @author Almas Baimagambetov ([email protected]) | ||
*/ | ||
public final class RunWithFX implements BeforeAllCallback { | ||
|