diff --git a/src/test/java/io/github/mrsaraira/constants/DemoTest.java b/src/test/java/io/github/mrsaraira/constants/DemoTest.java index 1bb9f76..37a53ef 100644 --- a/src/test/java/io/github/mrsaraira/constants/DemoTest.java +++ b/src/test/java/io/github/mrsaraira/constants/DemoTest.java @@ -100,9 +100,11 @@ use the anonymous class anywhere beside this method, also you have container ins // Check any relation by static references of the constants assertTrue(Constants.anyRelationValue(1, DemoRelationContainerWithStaticFinalFields.ONE, DemoRelationContainerWithStaticFinalFields.TWO, DemoRelationContainerWithStaticFinalFields.THREE)); - // Check any value by container local refs + // Check any value by container constants references var containerWithFields = Constants.getInstance(DemoContainerWithStaticFields.class); assertTrue(Constants.anyValue("One", DemoContainerWithStaticFields.ONE, DemoContainerWithStaticFields.TWO, DemoContainerWithStaticFields.THREE)); + // Check any value by combining different constants from different containers as long they have same generic value type + assertTrue(Constants.anyValue("One", DemoContainerWithStaticFields.ONE, DemoRelationContainerWithStaticFinalFields.ONE.getKey())); // Get optional constant value by value var one = Constants.getKeyValue("One", DemoRelationContainerWithStaticFinalFields.class); @@ -158,7 +160,6 @@ protected List> initialConstants() { private static class DemoContainerWithStaticFields extends AbstractConstantContainer { - // local variables public static Constant ONE = Constants.of("One"); public static Constant TWO = Constants.of("Two"); public static Constant THREE = Constants.of("Three"); @@ -177,7 +178,6 @@ protected List> initialConstants() { private static class DemoRelationContainerWithStaticFinalFields extends AbstractRelationConstantContainer { - // static references public static final RelationConstant ONE = Constants.of("One", 1); public static final RelationConstant TWO = Constants.of("Two", 2); public static final RelationConstant THREE = Constants.of("Three", 3); @@ -210,7 +210,7 @@ protected List> initialConstants() { } - // however this container will work, because values are initiated and not the constants in the local fields. + // However this container will work, because values are initiated and not the constants in the local fields. // But this container is not as useful as other containers. private static class DemoContainerWithNonStaticValuesFields extends AbstractConstantContainer {