@Test public void testWriteToCollection() throws Exception { MongoItemWriter<String> writer = new MongoItemWriterBuilder<String>().collection("collection") .template(this.template) .build(); writer.write(this.items); verify(this.template).save(this.items.get(0), "collection"); verify(this.template).save(this.items.get(1), "collection"); verify(this.template, never()).remove(this.items.get(0), "collection"); verify(this.template, never()).remove(this.items.get(1), "collection"); }