Field implements IField { @Override public <T> void out(final IObject obj, final T in) throws ChangeValueException, InvalidArgumentException { if (null == obj) { throw new InvalidArgumentException("Argument should not be null."); } obj.setValue(fieldName, in); } Field(final IFieldName fieldName); @Override T in(final IObject obj); @Override T in(final IObject obj, final Class type); @Override void out(final IObject obj, final T in);  }
@Test public void checkOutMethod() throws Exception { IField field = new Field(new FieldName("a")); IObject env = mock(IObject.class); doNothing().when(env).setValue(new FieldName("a"), 1); field.out(env, 1); verify(env, times(1)).setValue(new FieldName("a"), 1); }
@Test (expected = InvalidArgumentException.class) public void checkOutMethodExceptionOnNullArgument() throws Exception { IField field = new Field(new FieldName("a")); field.out(null, 1); fail(); }