### Question:
Operations extends EnumMap<ChangeType, List<IOperation>> { public void addOperation( ChangeType operationType, IOperation operation ) { List<IOperation> operations = get( operationType ); if ( operations == null ) { operations = new ArrayList<IOperation>(); put( operationType, operations ); } operations.add( operation ); } Operations(); void addOperation( ChangeType operationType, IOperation operation );  }### Answer:
@Test public void testAddOperation() throws Exception { assertTrue( operations.isEmpty() ); Operation operation = new Operation( "opName", "opDesc" ); operations.addOperation( ChangeType.METADATA, operation ); assertEquals( 1, operations.size() ); }
@Test public void testGetOperationByType() throws Exception { Operation operation = new Operation( "opName", "opDesc" ); operations.addOperation( ChangeType.METADATA, operation ); Operation operation2 = new Operation( "opName2", "opDesc2" ); operations.addOperation( ChangeType.METADATA, operation2 ); Operation operation3 = new Operation( "opName3", "opDesc3" ); operations.addOperation( ChangeType.DATA, operation3 ); List<IOperation> metadataOperations = operations.get( ChangeType.METADATA ); List<IOperation> dataOperations = operations.get( ChangeType.DATA ); assertNotNull( metadataOperations ); assertNotNull( dataOperations ); assertEquals( 2, metadataOperations.size() ); assertEquals( 1, dataOperations.size() ); }