|
|
@@ -80,7 +80,7 @@ public class ArticleAdminControllerTest {
|
|
|
Page<Article> page = new Page<>(1, 20, 2);
|
|
|
page.setRecords(records);
|
|
|
|
|
|
- when(articleService.getAdminList(isNull(), isNull(), isNull(), eq(1), eq(20)))
|
|
|
+ when(articleService.getAdminList(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), eq(1), eq(20)))
|
|
|
.thenReturn(page);
|
|
|
|
|
|
Result<Page<Article>> result = controller.list(body);
|
|
|
@@ -103,7 +103,7 @@ public class ArticleAdminControllerTest {
|
|
|
Page<Article> page = new Page<>(1, 10, 1);
|
|
|
page.setRecords(records);
|
|
|
|
|
|
- when(articleService.getAdminList(eq("published"), eq(2L), eq("健康"), eq(1), eq(10)))
|
|
|
+ when(articleService.getAdminList(eq("published"), eq(2L), eq("健康"), isNull(), isNull(), isNull(), isNull(), eq(1), eq(10)))
|
|
|
.thenReturn(page);
|
|
|
|
|
|
Result<Page<Article>> result = controller.list(body);
|
|
|
@@ -118,7 +118,7 @@ public class ArticleAdminControllerTest {
|
|
|
Page<Article> page = new Page<>(1, 20, 0);
|
|
|
page.setRecords(Collections.emptyList());
|
|
|
|
|
|
- when(articleService.getAdminList(isNull(), isNull(), isNull(), eq(1), eq(20)))
|
|
|
+ when(articleService.getAdminList(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), eq(1), eq(20)))
|
|
|
.thenReturn(page);
|
|
|
|
|
|
Result<Page<Article>> result = controller.list(body);
|
|
|
@@ -146,11 +146,15 @@ public class ArticleAdminControllerTest {
|
|
|
|
|
|
@Test
|
|
|
public void update_Success() {
|
|
|
- Article article = mockArticle(1L, "更新后的文章", "published", 0);
|
|
|
+ Map<String, Object> body = new HashMap<>();
|
|
|
+ body.put("id", 1L);
|
|
|
+ body.put("title", "更新后的文章");
|
|
|
+ body.put("content", "新内容");
|
|
|
+ body.put("status", "published");
|
|
|
|
|
|
doNothing().when(articleService).update(any(Article.class));
|
|
|
|
|
|
- Result<String> result = controller.update(article);
|
|
|
+ Result<String> result = controller.update(body);
|
|
|
assertEquals(200, result.getCode());
|
|
|
assertEquals("更新成功", result.getData());
|
|
|
verify(articleService).update(any(Article.class));
|