修复bug

This commit is contained in:
禾几海
2020-05-26 12:54:24 +08:00
parent aa882406d0
commit 03cb04ab06
9 changed files with 14 additions and 11 deletions

View File

@@ -164,7 +164,7 @@ public class ArticleMapperTest extends BaseTest {
@Test
public void findAllByCategoryIdAndOpen() {
List<Article> allByCategoryId = articleMapper.findAllByCategoryId(1);
List<Article> allByCategoryId = articleMapper.findAllByCategoryIdAndOpen(1);
assertNotEquals(0, allByCategoryId.size());
allByCategoryId.forEach(article -> assertTrue(article.getOpen()));
}

View File

@@ -106,7 +106,7 @@ public class ArticleTagMapperTest extends BaseTest {
@Test
public void findArticleByTagAndOpen() {
ArticleTag articleTag = generateArticle();
List<ArticleTag> articleByTag = articleTagMapper.findArticleByTag(21L);
List<ArticleTag> articleByTag = articleTagMapper.findArticleByTagAndOpen(21L);
assertNotEquals(0, articleByTag.size());
articleByTag.forEach(articleTag1 -> assertEquals(articleTag.getTag().getName(), articleTag1.getTag().getName()));
articleByTag.forEach(articleTag1 -> assertTrue(articleTag1.getArticle().getOpen()));

View File

@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import static org.junit.Assert.*;
@@ -106,7 +107,8 @@ public class CategoryMapperTest extends BaseTest {
@Test
public void count() {
List<Category> all = categoryMapper.findAll();
assertEquals(all.size(), categoryMapper.count());
List<Category> collect = all.stream().filter(category -> !category.isDeleted()).collect(Collectors.toList());
assertEquals(collect.size(), categoryMapper.count());
}
private Category generateCategory() {

View File

@@ -6,6 +6,7 @@ import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.stream.Collectors;
import static org.junit.Assert.*;
@@ -79,7 +80,8 @@ public class TagMapperTest extends BaseTest {
public void count() {
assertNotEquals(0, tagMapper.count());
List<Tag> all = tagMapper.findAll();
assertEquals(all.size(), tagMapper.count());
List<Tag> collect = all.stream().filter(tag -> !tag.isDeleted()).collect(Collectors.toList());
assertEquals(collect.size(), tagMapper.count());
}
private Tag generateTag() {