Ejemplo n.º 1
0
 public void testValueOfFunction_equals() {
   new EqualsTester()
       .addEqualityGroup(
           Enums.valueOfFunction(TestEnum.class), Enums.valueOfFunction(TestEnum.class))
       .addEqualityGroup(Enums.valueOfFunction(OtherEnum.class))
       .testEquals();
 }
Ejemplo n.º 2
0
 public NetworkGroupFilterSupport() {
   super(
       builderFor(NetworkGroup.class)
           .withTagFiltering(NetworkGroupTag.class, "networkGroup")
           .withStringProperty("description", FilterFunctions.DESCRIPTION)
           .withStringProperty("group-id", FilterFunctions.GROUP_ID)
           .withStringProperty("group-name", CloudMetadatas.toDisplayName())
           .withStringSetProperty("ip-permission.cidr", FilterSetFunctions.PERMISSION_CIDR)
           .withStringSetProperty(
               "ip-permission.from-port", FilterSetFunctions.PERMISSION_FROM_PORT)
           .withStringSetProperty(
               "ip-permission.group-name", FilterSetFunctions.PERMISSION_GROUP)
           .withStringSetProperty(
               "ip-permission.protocol", FilterSetFunctions.PERMISSION_PROTOCOL)
           .withStringSetProperty("ip-permission.to-port", FilterSetFunctions.PERMISSION_TO_PORT)
           .withStringSetProperty(
               "ip-permission.user-id", FilterSetFunctions.PERMISSION_ACCOUNT_ID)
           .withStringProperty("owner-id", FilterFunctions.ACCOUNT_ID)
           .withPersistenceAlias("networkRules", "networkRules")
           .withPersistenceFilter("description")
           .withPersistenceFilter("group-id", "groupId")
           .withPersistenceFilter("group-name", "displayName")
           .withPersistenceFilter(
               "ip-permission.from-port", "networkRules.lowPort", PersistenceFilter.Type.Integer)
           .withPersistenceFilter(
               "ip-permission.protocol",
               "networkRules.protocol",
               Enums.valueOfFunction(NetworkRule.Protocol.class))
           .withPersistenceFilter(
               "ip-permission.to-port", "networkRules.highPort", PersistenceFilter.Type.Integer)
           .withPersistenceFilter("owner-id", "ownerAccountNumber"));
 }
Ejemplo n.º 3
0
 @GwtIncompatible("SerializableTester")
 public void testValueOfFunction_serialization() {
   Function<String, TestEnum> function = Enums.valueOfFunction(TestEnum.class);
   SerializableTester.reserializeAndAssert(function);
 }
Ejemplo n.º 4
0
 public void testValueOfFunction_nullWhenNoMatchingConstant() {
   Function<String, TestEnum> function = Enums.valueOfFunction(TestEnum.class);
   assertNull(function.apply("WOMBAT"));
 }
Ejemplo n.º 5
0
 public void testValueOfFunction_caseSensitive() {
   Function<String, TestEnum> function = Enums.valueOfFunction(TestEnum.class);
   assertNull(function.apply("cHEETO"));
   assertNull(function.apply("Honda"));
   assertNull(function.apply("poodlE"));
 }
Ejemplo n.º 6
0
 public void testValueOfFunction() {
   Function<String, TestEnum> function = Enums.valueOfFunction(TestEnum.class);
   assertEquals(TestEnum.CHEETO, function.apply("CHEETO"));
   assertEquals(TestEnum.HONDA, function.apply("HONDA"));
   assertEquals(TestEnum.POODLE, function.apply("POODLE"));
 }