|
|
@@ -93,12 +93,16 @@ public class AdminArticleControllerTest {
|
|
|
|
|
|
@Test
|
|
|
public void adminCreate_Success() {
|
|
|
- Article article = mockArticle(null, "新文章", "draft");
|
|
|
- doNothing().when(articleService).create(article, 1L);
|
|
|
+ Map<String, Object> body = new HashMap<>();
|
|
|
+ body.put("title", "新文章");
|
|
|
+ body.put("content", "内容");
|
|
|
+ body.put("status", "draft");
|
|
|
|
|
|
- Result<String> result = controller.create(article, 1L);
|
|
|
+ doNothing().when(articleService).create(any(Article.class), eq(1L));
|
|
|
+
|
|
|
+ Result<Map<String, Object>> result = controller.create(body, 1L);
|
|
|
assertEquals(200, result.getCode());
|
|
|
- assertEquals("创建成功", result.getData());
|
|
|
+ assertNotNull(result.getData());
|
|
|
}
|
|
|
|
|
|
// ==================== update ====================
|