/** * Validates and builds a {@link MongoItemWriter}. * * @return a {@link MongoItemWriter} */ public MongoItemWriter<T> build() { Assert.notNull(this.template, "template is required."); MongoItemWriter<T> writer = new MongoItemWriter<>(); writer.setTemplate(this.template); writer.setDelete(this.delete); writer.setCollection(this.collection); return writer; }
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); writer = new MongoItemWriter<>(); writer.setTemplate(template); writer.afterPropertiesSet(); }
}).when(mongoOperations).save(any(String.class)); writers.add(i, new MongoItemWriter<>()); writers.get(i).setTemplate(mongoOperations);
@Test public void testAfterPropertiesSet() throws Exception { writer = new MongoItemWriter<>(); try { writer.afterPropertiesSet(); fail("Expected exception was not thrown"); } catch (IllegalStateException ignore) { } writer.setTemplate(template); writer.afterPropertiesSet(); }
/** * Validates and builds a {@link MongoItemWriter}. * * @return a {@link MongoItemWriter} */ public MongoItemWriter<T> build() { Assert.notNull(this.template, "template is required."); MongoItemWriter<T> writer = new MongoItemWriter<>(); writer.setTemplate(this.template); writer.setDelete(this.delete); writer.setCollection(this.collection); return writer; }