### Question:
MongoDbActivityStreamsRepository implements ActivityStreamsRepository { @Override public List<ActivityStreamsEntry> getByUserId(String id) { return toBaseTypedList(template.find(query(where("actor._id").is(id)),CLASS, ACTIVITIES)); } @Autowired  MongoDbActivityStreamsRepository(MongoOperations template, HydratingConverterFactory converter); @Override List<ActivityStreamsEntry> getAll(); @Override List<ActivityStreamsEntry> getLimitedList(int offset, int limit); @Override int getCountAll(); @Override List<ActivityStreamsEntry> getByUserId(String id); @Override void deleteById(String id); @Override Class<? extends ActivityStreamsEntry> getType(); @Override ActivityStreamsEntry get(String id); @Override ActivityStreamsEntry save(ActivityStreamsEntry item); @Override void delete(ActivityStreamsEntry item);  }### Answer:
@Test public void getByUserId() { List<MongoDbActivityStreamsEntry> result = Lists.newArrayList(); expect(template.find(Query.query(Criteria.where("actor._id").is(ID)), ENTITY_CLASS, ACTIVITIES)).andReturn(result); replay(template); List<ActivityStreamsEntry> entries = repository.getByUserId(ID); assertThat((Object)entries, is(sameInstance((Object)result))); }