@Test public void test() { PersonLookupViaAttribute sut = new PersonLookupViaAttribute(ldapLookup); final List<Person> rawResults = new ArrayList<Person>(Arrays.asList(p)); final ArrayList<String> sourceList = new ArrayList<String>(); context.checking(new Expectations() { { oneOf(ldapLookup).execute(with(any(LdapLookupRequest.class))); will(returnValue(rawResults)); allowing(p).getSourceList(); will(returnValue(sourceList)); } }); assertEquals(rawResults, sut.findPeople("foo", 5)); assertEquals("foo", p.getSourceList().get(0)); context.assertIsSatisfied(); }
@Override public List<Person> findPeople(final String inSearchString, final int inResultsUpperBound) { List<Person> results = ldapLookup.execute(new LdapLookupRequest(inSearchString, inResultsUpperBound)); for (Person p : results) { p.getSourceList().add(inSearchString); } return results; }
PersonLookupViaAttribute implements PersonLookupStrategy { @Override public List<Person> findPeople(final String inSearchString, final int inResultsUpperBound) { List<Person> results = ldapLookup.execute(new LdapLookupRequest(inSearchString, inResultsUpperBound)); for (Person p : results) { p.getSourceList().add(inSearchString); } return results; } }
PersonLookupViaAttribute implements PersonLookupStrategy { @Override public List<Person> findPeople(final String inSearchString, final int inResultsUpperBound) { List<Person> results = ldapLookup.execute(new LdapLookupRequest(inSearchString, inResultsUpperBound)); for (Person p : results) { p.getSourceList().add(inSearchString); } return results; } PersonLookupViaAttribute(final LdapLookup<Person> inLdapLookup); }
PersonLookupViaAttribute implements PersonLookupStrategy { @Override public List<Person> findPeople(final String inSearchString, final int inResultsUpperBound) { List<Person> results = ldapLookup.execute(new LdapLookupRequest(inSearchString, inResultsUpperBound)); for (Person p : results) { p.getSourceList().add(inSearchString); } return results; } PersonLookupViaAttribute(final LdapLookup<Person> inLdapLookup); @Override List<Person> findPeople(final String inSearchString, final int inResultsUpperBound); }
PersonLookupViaAttribute implements PersonLookupStrategy { @Override public List<Person> findPeople(final String inSearchString, final int inResultsUpperBound) { List<Person> results = ldapLookup.execute(new LdapLookupRequest(inSearchString, inResultsUpperBound)); for (Person p : results) { p.getSourceList().add(inSearchString); } return results; } PersonLookupViaAttribute(final LdapLookup<Person> inLdapLookup); @Override List<Person> findPeople(final String inSearchString, final int inResultsUpperBound);  }