### Question:
LdapAdapter implements TokenStorageAdapter<Connection> { public void create(Connection connection, Token token) throws LdapOperationFailedException { Entry entry = conversion.getEntry(token); try { processResult(connection.add(LDAPRequests.newAddRequest(entry))); } catch (LdapException e) { throw new LdapOperationFailedException(e.getResult()); } } @Inject  LdapAdapter(LdapTokenAttributeConversion conversion, LdapQueryFilterVisitor queryConverter,
            LdapQueryFactory queryFactory); void create(Connection connection, Token token); Token read(Connection connection,  String tokenId); boolean update(Connection connection, Token previous, Token updated); void delete(Connection connection, String tokenId); @Override Collection<Token> query(Connection connection, TokenFilter query); @Override Collection<PartialToken> partialQuery(Connection connection, TokenFilter query);  }### Answer:
@Test public void shouldUseConnectionForCreate() throws Exception { Token token = new Token("badger", TokenType.SESSION); Result successResult = mockSuccessfulResult(); given(mockConnection.add(nullable(Entry.class))).willReturn(successResult); given(mockConversion.getEntry(nullable(Token.class))).willReturn(mock(Entry.class)); adapter.create(mockConnection, token); verify(mockConnection).add(any(Entry.class)); }
@Test public void shouldUseConnectionForCreate() throws Exception { Token token = new Token("badger", TokenType.SESSION); Result successResult = mockSuccessfulResult(); given(mockConnection.add(any(Entry.class))).willReturn(successResult); given(mockConversion.getEntry(any(Token.class))).willReturn(mock(Entry.class)); adapter.create(mockConnection, token); verify(mockConnection).add(any(Entry.class)); }