PropertiesWrapper implements Properties { @Override public void setProperty(@NotNull String name, @NotNull String value) throws IllegalAccessException, NoSuchFieldException, PropertyVetoException, IllegalArgumentException { FieldInstance field = getFieldInstanceForModify(name); try { field.getPropertyHandler().set(field, value); } catch (UnsupportedOperationException e) { throw new PropertyVetoException(CANNOT_SET_PROPERTY.bundle(name)); } } private  PropertiesWrapper(@NotNull Object object); protected  PropertiesWrapper(); static Properties wrapObject(@NotNull Object object); static String[] getAllPropertyNames(Class clazz); @NotNull @Override String[] getAllPropertyNames(); @Nullable @Override Object getProperty(@NotNull String name); @Override void setProperty(@NotNull String name, @NotNull String value); @Override void addProperty(@NotNull String name, @NotNull String value); @Override void removeProperty(@NotNull String name, @NotNull String value); @Override void clearProperty(@NotNull String name, @Nullable String value); @Nullable @Override Object getPropertyUnchecked(@NotNull String name); @Override boolean setPropertyUnchecked(@NotNull String name, @NotNull String value); @Override boolean addPropertyUnchecked(@NotNull String name, @NotNull String value); @Override boolean removePropertyUnchecked(@NotNull String name, @NotNull String value); @Override boolean clearPropertyUnchecked(@NotNull String name, @Nullable String value);  }
@Test public void testSetProperty() throws Exception { assertFalse(comprehensive.aInt == 500); comprehensive.setProperty("aint", "500"); assertEquals(500, comprehensive.aInt); }
@Test public void testSetPropertyNested() throws Exception { assertFalse(comprehensive.custom.name.equals("aname")); comprehensive.setProperty("custom.name", "aname"); assertEquals("aname", comprehensive.custom.name); }
@Test(expected = NoSuchFieldException.class) public void testSetPropertyNoSuchField() throws Exception { comprehensive.setProperty("booboooboo", "value"); }
@Test(expected = NoSuchFieldException.class) public void testSetPropertyNestedNoSuchField() throws Exception { comprehensive.setProperty("custom.fake", "value"); }
@Test(expected = IllegalArgumentException.class) public void testSetPropertyIllegalValue() throws Exception { comprehensive.setProperty("aint", "value"); }
@Test(expected = IllegalAccessException.class) public void testSetPropertyImmutable() throws Exception { comprehensive.setProperty("immutableString", new Custom("test").toString()); }