StandardPropertyFactory { public static StandardProperty getByName(String propertyName) { StandardProperty standardProperty = ALL.get(propertyName.toLowerCase(Locale.ENGLISH)); return standardProperty != null ? standardProperty : new UnknownProperty(propertyName); } private  StandardPropertyFactory(); static StandardProperty getByName(String propertyName); static List<StandardProperty> getAll();  }
@Test public void should_return_a_valid_border_property_object() { StandardProperty property = StandardPropertyFactory.getByName("border"); assertEquals(Border.class, property.getClass()); assertEquals(property.getName(), "border"); assertEquals(property.getLinks().size(), 2); assertEquals(property.getLinks().get(0), "https: assertEquals(property.getLinks().get(1), "https: assertEquals(property.getVendors().size(), 0); assertEquals(property.isObsolete(), false); }
@Test public void should_return_a_valid_border_property_object_uppercase_test() { StandardProperty property = StandardPropertyFactory.getByName("BORDER"); assertEquals(Border.class, property.getClass()); assertEquals(property.getName(), "border"); assertEquals(property.getLinks().size(), 2); assertEquals(property.getLinks().get(0), "https: assertEquals(property.getLinks().get(1), "https: assertEquals(property.getVendors().size(), 0); assertEquals(property.isObsolete(), false); }
@Test public void should_return_a_valid_border_end_property_object() { StandardProperty property = StandardPropertyFactory.getByName("border-end"); assertEquals(BorderEnd.class, property.getClass()); assertEquals(property.getName(), "border-end"); assertEquals(property.getLinks().size(), 0); assertEquals(property.getValidators().size(), 0); assertEquals(property.getVendors().size(), 0); assertEquals(property.isObsolete(), true); }
@Test public void should_return_a_valid_transition_property_object() { StandardProperty property = StandardPropertyFactory.getByName("transition-property"); assertEquals(TransitionProperty.class, property.getClass()); assertEquals(property.getName(), "transition-property"); assertEquals(property.getLinks().size(), 1); assertEquals(property.getLinks().get(0), "https: assertEquals(property.getValidators().size(), 0); assertEquals(property.getVendors().size(), 1); assertEquals(property.getVendors().contains(Vendor.WEBKIT), true); assertEquals(property.getVendors().contains(Vendor.MICROSOFT), false); assertEquals(property.isObsolete(), false); }
@Test public void should_return_an_unknown_property_object() { StandardProperty property = StandardPropertyFactory.getByName("Bla-bla"); assertEquals(UnknownProperty.class, property.getClass()); assertEquals("bla-bla", property.getName()); assertEquals(property.getLinks().size(), 0); assertEquals(property.getValidators().size(), 0); assertEquals(property.getVendors().size(), 0); assertEquals(property.isObsolete(), false); }