### Question:
ReplaceOperation extends PatchOperation { @Override <T> void perform(Object target, Class<T> type) { setValueOnTarget(target, evaluateValueFromTarget(target, type)); } ReplaceOperation(String path, Object value);   }### Answer:
@Test public void replaceBooleanPropertyValue() throws Exception { List<Todo> todos = new ArrayList<Todo>(); todos.add(new Todo(1L, "A", false)); todos.add(new Todo(2L, "B", false)); todos.add(new Todo(3L, "C", false)); ReplaceOperation replace = new ReplaceOperation("/1/complete", true); replace.perform(todos, Todo.class); assertTrue(todos.get(1).isComplete()); }
@Test public void replaceTextPropertyValue() throws Exception { List<Todo> todos = new ArrayList<Todo>(); todos.add(new Todo(1L, "A", false)); todos.add(new Todo(2L, "B", false)); todos.add(new Todo(3L, "C", false)); ReplaceOperation replace = new ReplaceOperation("/1/description", "BBB"); replace.perform(todos, Todo.class); assertEquals("BBB", todos.get(1).getDescription()); }
@Test public void replaceTextPropertyValueWithANumber() throws Exception { List<Todo> todos = new ArrayList<Todo>(); todos.add(new Todo(1L, "A", false)); todos.add(new Todo(2L, "B", false)); todos.add(new Todo(3L, "C", false)); ReplaceOperation replace = new ReplaceOperation("/1/description", 22); replace.perform(todos, Todo.class); assertEquals("22", todos.get(1).getDescription()); }