### Question:
MicroOperationFilter implements ACITupleFilter { @Override public Collection<ACITuple> filter( AciContext aciContext, OperationScope scope, Entry userEntry ) throws LdapException { if ( aciContext.getAciTuples().isEmpty() ) { return aciContext.getAciTuples(); } for ( Iterator<ACITuple> i = aciContext.getAciTuples().iterator(); i.hasNext(); ) { ACITuple tuple = i.next(); boolean retain = true; for ( MicroOperation microOp : aciContext.getMicroOperations() ) { if ( !tuple.getMicroOperations().contains( microOp ) ) { retain = false; break; } } if ( !retain ) { i.remove(); } } return aciContext.getAciTuples(); }  @Override Collection<ACITuple> filter( AciContext aciContext, OperationScope scope, Entry userEntry );  }### Answer:
@Test public void testZeroTuple() throws Exception { MicroOperationFilter filter = new MicroOperationFilter(); AciContext aciContext = new AciContext( null, null ); aciContext.setAciTuples( EMPTY_ACI_TUPLE_COLLECTION ); assertEquals( 0, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() ); }
@Test public void testOneTuple() throws Exception { MicroOperationFilter filter = new MicroOperationFilter(); Collection<ACITuple> tuples = new ArrayList<ACITuple>(); tuples.add( new ACITuple( EMPTY_USER_CLASS_COLLECTION, AuthenticationLevel.NONE, EMPTY_PROTECTED_ITEM_COLLECTION, TUPLE_OPERATIONS, true, 0 ) ); AciContext aciContext = new AciContext( null, null ); aciContext.setMicroOperations( USER_OPERATIONS_A ); aciContext.setAciTuples( tuples ); assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() ); aciContext = new AciContext( null, null ); aciContext.setMicroOperations( USER_OPERATIONS_B ); aciContext.setAciTuples( tuples ); assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() ); }