### Question:
ModelKeyParser { public static Mutation createDeleteMutation(FieldMapping mapping, String modelName) { ColumnVisibility cv = new ColumnVisibility(mapping.getColumnVisibility()); Mutation m; String dataType = StringUtils.isEmpty(mapping.getDatatype()) ? "" : NULL_BYTE + mapping.getDatatype().trim(); if (Direction.REVERSE.equals(mapping.getDirection())) { m = new Mutation(mapping.getFieldName()); m.putDelete(modelName + dataType, mapping.getModelFieldName() + NULL_BYTE + mapping.getDirection().getValue(), cv, System.currentTimeMillis()); return m; } else { m = new Mutation(mapping.getModelFieldName()); m.putDelete(modelName + dataType, mapping.getFieldName() + NULL_BYTE + mapping.getDirection().getValue(), cv, System.currentTimeMillis()); m.putDelete(modelName + dataType, mapping.getFieldName() + NULL_BYTE + "index_only" + NULL_BYTE + mapping.getDirection().getValue(), cv, System.currentTimeMillis()); return m; } }  static FieldMapping parseKey(Key key, Set<Authorizations> auths); static Key createKey(FieldMapping mapping, String modelName); static Mutation createMutation(FieldMapping mapping, String modelName); static Mutation createDeleteMutation(FieldMapping mapping, String modelName); static final String NULL_BYTE; static final Value NULL_VALUE; }### Answer:
@Test public void testForwardCreateDeleteMutation() throws Exception { EasyMock.expect(System.currentTimeMillis()).andReturn(TIMESTAMP).times(2); PowerMock.replayAll(); Mutation m = ModelKeyParser.createDeleteMutation(FORWARD_FIELD_MAPPING, MODEL_NAME); PowerMock.verifyAll(); m.getUpdates(); Assert.assertEquals(FORWARD_DELETE_MUTATION, m); PowerMock.resetAll(); EasyMock.expect(System.currentTimeMillis()).andReturn(TIMESTAMP).times(2); FORWARD_FIELD_MAPPING.setDatatype(null); PowerMock.replayAll(); FORWARD_DELETE_MUTATION = new Mutation(MODEL_FIELD_NAME); FORWARD_DELETE_MUTATION.putDelete(MODEL_NAME, FIELD_NAME + ModelKeyParser.NULL_BYTE + FORWARD.getValue(), new ColumnVisibility(COLVIZ), TIMESTAMP); FORWARD_DELETE_MUTATION.putDelete(MODEL_NAME, FIELD_NAME + ModelKeyParser.NULL_BYTE + "index_only" + ModelKeyParser.NULL_BYTE + FORWARD.getValue(), new ColumnVisibility(COLVIZ), TIMESTAMP); m = ModelKeyParser.createDeleteMutation(FORWARD_FIELD_MAPPING, MODEL_NAME); PowerMock.verifyAll(); m.getUpdates(); Assert.assertEquals(FORWARD_DELETE_MUTATION, m); }
@Test public void testReverseCreateDeleteMutation() throws Exception { EasyMock.expect(System.currentTimeMillis()).andReturn(TIMESTAMP); PowerMock.replayAll(); Mutation m = ModelKeyParser.createDeleteMutation(REVERSE_FIELD_MAPPING, MODEL_NAME); PowerMock.verifyAll(); m.getUpdates(); Assert.assertEquals(REVERSE_DELETE_MUTATION, m); PowerMock.resetAll(); EasyMock.expect(System.currentTimeMillis()).andReturn(TIMESTAMP); REVERSE_FIELD_MAPPING.setDatatype(null); PowerMock.replayAll(); REVERSE_DELETE_MUTATION = new Mutation(FIELD_NAME); REVERSE_DELETE_MUTATION .putDelete(MODEL_NAME, MODEL_FIELD_NAME + ModelKeyParser.NULL_BYTE + REVERSE.getValue(), new ColumnVisibility(COLVIZ), TIMESTAMP); m = ModelKeyParser.createDeleteMutation(REVERSE_FIELD_MAPPING, MODEL_NAME); PowerMock.verifyAll(); m.getUpdates(); Assert.assertEquals(REVERSE_DELETE_MUTATION, m); }