mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-09 12:17:29 +08:00
Merge pull request #48 from nagisa77/codex/fix-unsatisfieddependencyexception-in-tests
Fix controller tests
This commit is contained in:
@@ -2,6 +2,7 @@ package com.openisle.controller;
|
|||||||
|
|
||||||
import com.openisle.model.Category;
|
import com.openisle.model.Category;
|
||||||
import com.openisle.service.CategoryService;
|
import com.openisle.service.CategoryService;
|
||||||
|
import com.openisle.service.PostService;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -26,6 +27,9 @@ class CategoryControllerTest {
|
|||||||
@MockBean
|
@MockBean
|
||||||
private CategoryService categoryService;
|
private CategoryService categoryService;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private PostService postService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void createAndGetCategory() throws Exception {
|
void createAndGetCategory() throws Exception {
|
||||||
Category c = new Category();
|
Category c = new Category();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.openisle.controller;
|
|||||||
|
|
||||||
import com.openisle.model.Tag;
|
import com.openisle.model.Tag;
|
||||||
import com.openisle.service.TagService;
|
import com.openisle.service.TagService;
|
||||||
|
import com.openisle.service.PostService;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -26,6 +27,9 @@ class TagControllerTest {
|
|||||||
@MockBean
|
@MockBean
|
||||||
private TagService tagService;
|
private TagService tagService;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private PostService postService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void createAndGetTag() throws Exception {
|
void createAndGetTag() throws Exception {
|
||||||
Tag t = new Tag();
|
Tag t = new Tag();
|
||||||
|
|||||||
Reference in New Issue
Block a user