@Test public void shouldHaveProperties() throws Exception { Reflection reflection = new Reflection(source.getClass()); Property property = reflection.getProperty(source, "updatesAllowed"); assertThat(property.getDescription(), is(GraphI18n.updatesAllowedPropertyDescription.text())); assertThat(property.getLabel(), is(GraphI18n.updatesAllowedPropertyLabel.text())); assertThat(property.getCategory(), is(GraphI18n.updatesAllowedPropertyCategory.text())); assertThat(property.getCategory(), is("Advanced")); assertThat(property.isInferred(), is(false)); assertThat(property.isReadOnly(), is(true)); assertThat(property.isBooleanType(), is(true)); property = reflection.getProperty(source, "defaultCachePolicy"); assertThat(property.getDescription(), is("")); assertThat(property.getLabel(), is("Default Cache Policy")); assertThat(property.getCategory(), is("")); assertThat(property.isInferred(), is(true)); assertThat(property.isReadOnly(), is(false)); assertThat(property.isBooleanType(), is(false)); Map<String, Property> properties = reflection.getAllPropertiesByNameOn(source); assertThat(properties.containsKey("name"), is(true)); assertThat(properties.containsKey("jndiName"), is(true)); assertThat(properties.containsKey("defaultWorkspaceName"), is(true)); assertThat(properties.containsKey("predefinedWorkspaceNames"), is(true)); assertThat(properties.containsKey("updatesAllowed"), is(true)); assertThat(properties.containsKey("defaultCachePolicy"), is(true)); }
assertThat(property.getLabel(), is("Status")); assertThat(property.getType().equals(Status.class), is(true)); assertThat(property.isReadOnly(), is(true)); assertThat(property, is(findProperty(property.getName(), props))); assertValue(reflection, problem, property, status); assertThat(property.getLabel(), is("Code")); assertThat(property.getType().equals(Integer.TYPE), is(true)); assertThat(property.isReadOnly(), is(true)); assertValue(reflection, problem, property, code); assertThat(property.getLabel(), is("Message")); assertThat(property.getType().equals(I18n.class), is(true)); assertThat(property.isReadOnly(), is(true)); assertValue(reflection, problem, property, msg); assertThat(property.getLabel(), is("Message String")); assertThat(property.getType().equals(String.class), is(true)); assertThat(property.isReadOnly(), is(true)); assertValue(reflection, problem, property, msg.text(params)); assertThat(property.getLabel(), is("Parameters")); assertThat(property.getType().equals(Object[].class), is(true)); assertThat(property.isReadOnly(), is(true)); assertValue(reflection, problem, property, params); assertThat(property.getLabel(), is("Resource")); assertThat(property.getType().equals(String.class), is(true)); assertThat(property.isReadOnly(), is(true));
assertThat(property.getCategory(), is(CommonI18n.noMoreContent.text())); assertThat(property.getType().equals(String.class), is(true)); assertThat(property.isReadOnly(), is(false)); assertThat(property, is(findProperty(property.getName(), props))); assertValue(reflection, structure, property, structure.getIdentifier()); assertThat(property.getCategory(), is("")); assertThat(property.getType().equals(Integer.TYPE), is(true)); assertThat(property.isReadOnly(), is(false)); assertValue(reflection, structure, property, structure.getCount()); assertThat(property.getCategory(), is("")); assertThat(property.getType().equals(Boolean.TYPE), is(true)); assertThat(property.isReadOnly(), is(true)); assertValue(reflection, structure, property, structure.isOnFire());