### Question:
WriteArticleServiceImpl { public Article writeArticle(Article article) { Integer id = idGenerator.getNextId(); article.setId(id); articleDao.insert(article); return article; }  Article writeArticle(Article article); void setArticleDao(ArticleDao mockedDao); void setIdGenerator(IdGenerator mockedGenerator);  }### Answer:
@Test public void writeArticle() { ArticleDao mockedDao = mock(ArticleDao.class); IdGenerator mockedGenerator = mock(IdGenerator.class); WriteArticleServiceImpl writeArticleService = new WriteArticleServiceImpl(); writeArticleService.setArticleDao(mockedDao); writeArticleService.setIdGenerator(mockedGenerator); Article article = new Article(); Article writtenArticle = writeArticleService.writeArticle(article); assertNotNull(writtenArticle); }