spring-boot-realworld-examp.../src/test/java/io/spring/application/tag/TagsQueryServiceTest.java

27 lines
939 B
Java

package io.spring.application.tag;
import static org.junit.Assert.assertTrue;
import io.spring.application.TagsQueryService;
import io.spring.core.article.Article;
import io.spring.core.article.ArticleRepository;
import io.spring.infrastructure.DbTestBase;
import io.spring.infrastructure.repository.MyBatisArticleRepository;
import java.util.Arrays;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Import;
@Import({TagsQueryService.class, MyBatisArticleRepository.class})
public class TagsQueryServiceTest extends DbTestBase {
@Autowired private TagsQueryService tagsQueryService;
@Autowired private ArticleRepository articleRepository;
@Test
public void should_get_all_tags() {
articleRepository.save(new Article("test", "test", "test", Arrays.asList("java"), "123"));
assertTrue(tagsQueryService.allTags().contains("java"));
}
}