### Question:
ModifyObjectByFieldAction extends Action { @Override public void execute() { runChange(newValue); } ModifyObjectByFieldAction(Object toModify, String field, Object oldValue, Object newValue);  ModifyObjectByFieldAction(Object toModify, String field, Object oldValue, Object newValue, boolean isPrivate);  ModifyObjectByFieldAction(Object toModify, String field, Object newValue); @Override void execute(); @Override void unExecute(); @Override String getExecuteText(); @Override String getUnexecuteText(); @Override Object getModifiedObject();  }### Answer:
@Test public void ModifyStringValidTest() throws Exception { SettableItem testItem = new SettableItem(); testItem.setString("initVal"); ModifyObjectByFieldAction action = new ModifyObjectByFieldAction(testItem, "string", testItem.getString(), "newVal"); invoker.execute(action); assertEquals("newVal", testItem.getString()); }
@Test public void ModifyStringValidUndoTest() throws Exception { SettableItem testItem = new SettableItem(); testItem.setString("initVal"); ModifyObjectByFieldAction action = new ModifyObjectByFieldAction(testItem, "string", testItem.getString(), "newVal"); invoker.execute(action); invoker.undo(); assertEquals("initVal", testItem.getString()); }
@Test public void ModifyPrimitiveIntValidTest() throws Exception { SettableItem testItem = new SettableItem(); testItem.setAnInt(1); ModifyObjectByFieldAction action = new ModifyObjectByFieldAction(testItem, "anInt", testItem.getAnInt(), 2); invoker.execute(action); assertEquals(2, testItem.getAnInt()); }
@Test public void ModifyPrimitiveIntSetIntegerValidTest() throws Exception { SettableItem testItem = new SettableItem(); testItem.setAnInt(1); ModifyObjectByFieldAction action = new ModifyObjectByFieldAction(testItem, "anInt", testItem.getAnInt(), 2); invoker.execute(action); assertEquals(2, testItem.getAnInt()); }
@Test public void ModifyObjectFromPrimitiveValidTest() throws Exception { SettableItem testItem = new SettableItem(); testItem.setInteger(1); ModifyObjectByFieldAction action = new ModifyObjectByFieldAction(testItem, "anInt", testItem.getInteger(), 2); invoker.execute(action); assertEquals(2, testItem.getAnInt()); }