From 31969cfb1f2d799627dbbdd3c7b926eeb4a28660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=A0=E4=B8=80=E4=B8=AA=E4=BA=BA=E5=9C=A8=E8=BF=99?= =?UTF-8?q?=E5=84=BF=E5=B9=B2=E5=98=9B=E4=BD=A0=E6=98=AF=E6=9D=A5=E6=8B=89?= =?UTF-8?q?=E5=B1=8E=E7=9A=84=E5=90=A7?= <1421374934@qq.com> Date: Sun, 2 Apr 2023 09:49:30 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=B5=8B=E8=AF=95=E8=BF=87=E7=9A=84?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ArticleThumbsUpServiceTest.java | 34 ++----------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java b/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java index 2feb248..c3a79a9 100644 --- a/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java @@ -1,7 +1,6 @@ package com.rymcu.forest.service; import com.rymcu.forest.core.exception.BusinessException; -import com.rymcu.forest.core.exception.ServiceException; import com.rymcu.forest.dto.ArticleDTO; import com.rymcu.forest.dto.ArticleSearchDTO; import com.rymcu.forest.entity.ArticleThumbsUp; @@ -42,13 +41,10 @@ class ArticleThumbsUpServiceTest { private ArticleService articleService; { - { articleThumbsUp = new ArticleThumbsUp(); articleThumbsUp.setIdArticle(-1L); articleThumbsUp.setThumbsUpTime(new Date()); articleThumbsUp.setIdUser(-1L); - - } } @@ -56,7 +52,7 @@ class ArticleThumbsUpServiceTest { * 测试点赞不存在的文章 */ @Test - void thumbsNotExistsArticle() { + public void thumbsNotExistsArticle() { assertThrows(BusinessException.class, () -> { articleThumbsUpService.thumbsUp(articleThumbsUp); }); @@ -66,20 +62,7 @@ class ArticleThumbsUpServiceTest { * 测试点赞存在的文章 */ @Test - void thumbsExistsArticle() { - assertThrows(NullPointerException.class, () -> { - assertDoesNotThrow(() -> { - List articles = articleService.findArticles(null); - }); - - }); - } - - /** - * 测试点赞存在的文章 - */ - @Test - void thumbsExistsArticle2() { + public void thumbsExistsArticle2() { assertDoesNotThrow(() -> { List articles = articleService.findArticles(new ArticleSearchDTO()); articleThumbsUp.setIdArticle(articles.get(0).getIdArticle()); @@ -89,17 +72,4 @@ class ArticleThumbsUpServiceTest { assertEquals(1, i); } - - /** - * 测试点赞存在的文章 - */ - @Test - void thumbsNotExistsUser() { - articleThumbsUp.setIdUser(null); - assertThrows(ServiceException.class, () -> { - articleThumbsUpService.thumbsUp(articleThumbsUp); - }); - } - - } \ No newline at end of file