Property { public void setValue(Object value) throws InvocationTargetException { setValueObject(value); } Property(Module module, String name, Class<?> type, Method getter, Method setter,
			Iterable<Annotation> annotations); String getInfo(); void setInfo(String info); int getOrder(); void setOrder(int order); String getName(); Class<?> getType(); Method getGetter(); Method getSetter(); void addRequirement(Requirement requirement); boolean isActive(); Collection<Requirement> getRequirements(); Object getValue(); void setValue(Object value); void setValue(String value); boolean isNumber(); Collection<Annotation> getAnnotations(); @SuppressWarnings("unchecked") A getAnnotation(Class<? extends A> clazz);  }
@Test public void setValue() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockInt", Integer.class); Property p = new Property(new MyModuleMock(), null, Integer.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue(4321); p.setValue("4321"); }
@Test(expected = InvocationTargetException.class) public void setValueException() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockInt", Integer.class); Property p = new Property(new MyModuleMock(), null, Integer.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue(3.0d); }
@Test(expected = InvocationTargetException.class) public void setValueExceptionString() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockInt", Integer.class); Property p = new Property(new MyModuleMock(), null, Integer.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue("3.0"); }
@Test public void setValueLong() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockLong", Long.class); Property p = new Property(new MyModuleMock(), null, Long.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue("43210000"); }
@Test public void setValueFloat() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockFloat", Float.class); Property p = new Property(new MyModuleMock(), null, Float.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue("3.0"); }
@Test public void setValueDouble() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockDouble", Double.class); Property p = new Property(new MyModuleMock(), null, Double.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue("1234.1234"); }
@Test public void setValueBoolean() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockBoolean", Boolean.class); Property p = new Property(new MyModuleMock(), null, Boolean.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue("true"); }
@Test public void setValueByte() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockByte", Byte.class); Property p = new Property(new MyModuleMock(), null, Byte.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue("-2"); }
@Test public void setValueShort() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockShort", Short.class); Property p = new Property(new MyModuleMock(), null, Short.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue("250"); }
@Test public void setValueString() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockString", String.class); Property p = new Property(new MyModuleMock(), null, String.class, null, setter, Collections.<Annotation> emptySet()); p.setValue("abc"); }
@Test public void setValueStringNull() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockStringNull", String.class); Property p = new Property(new MyModuleMock(), null, String.class, null, setter, Collections.<Annotation> emptySet()); p.setValue(null); }
@Test public void setValueChar() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockChar", Character.TYPE); Property p = new Property(new MyModuleMock(), null, Character.TYPE, null, setter, Collections.<Annotation> emptySet()); p.setValue("c"); }
@Test public void setValueCharacter() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockChar", Character.TYPE); Property p = new Property(new MyModuleMock(), null, Character.class, null, setter, Collections.<Annotation> emptySet()); p.setValue("c"); }
@Test public void setValueEnum() throws NoSuchMethodException, SecurityException, InvocationTargetException { Method setter = MyModuleMock.class.getMethod("setMockEnum", MyEnum.class); Property p = new Property(new MyModuleMock(), null, MyEnum.class, null, setter, Collections.<Annotation> emptySet()); p.setValue("X"); }