### Question:
MongoDbCategoryRepository implements CategoryRepository { @Override public int removeFromCreatedOrModifiedFields(String userId) { List<MongoDbCategory> categories = template.find(query(where("lastModifiedUserId").is(userId).orOperator(where("createdUserId").is(userId))), CLASS, CATEGORY_COLLECTION); int count = 0; for(MongoDbCategory category : categories) { boolean updated = updateCategory(userId, category); if(updated) { save(category); count++; } } return count; }  @Override List<Category> getAll(); @Override List<Category> getLimitedList(int offset, int limit); @Override int getCountAll(); @Override int removeFromCreatedOrModifiedFields(String userId); @Override Class<? extends Category> getType(); @Override Category get(String id); @Override Category save(Category item); @Override void delete(Category item); void setTemplate(MongoOperations template); void setConverter(HydratingConverterFactory converter); static final Class<MongoDbCategory> CLASS; }### Answer:
@Test public void removeFromCreatedOrModifiedFields_NotUpdated(){ String userId = "54321"; MongoDbCategory category = new MongoDbCategory(); List<MongoDbCategory> categories = Arrays.asList(category); category.setCreatedUserId("234"); category.setLastModifiedUserId("234"); expect(template.find(query(Criteria.where("lastModifiedUserId").is(userId).orOperator(Criteria.where("createdUserId").is(userId))), categoryRepository.CLASS, CollectionNames.CATEGORY_COLLECTION)).andReturn(categories); replay(template); int count = categoryRepository.removeFromCreatedOrModifiedFields(userId); assertThat(count, is(equalTo(0))); }