Skip to content

Commit

Permalink
Update DemoTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsaraira committed Oct 16, 2023
1 parent 87f48a4 commit 386a5d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/test/java/io/github/mrsaraira/constants/DemoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -158,7 +160,6 @@ protected List<Constant<String>> initialConstants() {

private static class DemoContainerWithStaticFields extends AbstractConstantContainer<String> {

// local variables
public static Constant<String> ONE = Constants.of("One");
public static Constant<String> TWO = Constants.of("Two");
public static Constant<String> THREE = Constants.of("Three");
Expand All @@ -177,7 +178,6 @@ protected List<Constant<String>> initialConstants() {

private static class DemoRelationContainerWithStaticFinalFields extends AbstractRelationConstantContainer<String, Integer> {

// static references
public static final RelationConstant<String, Integer> ONE = Constants.of("One", 1);
public static final RelationConstant<String, Integer> TWO = Constants.of("Two", 2);
public static final RelationConstant<String, Integer> THREE = Constants.of("Three", 3);
Expand Down Expand Up @@ -210,7 +210,7 @@ protected List<Constant<String>> 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<String> {

Expand Down

0 comments on commit 386a5d8

Please sign in to comment.