Skip to content

Commit 3faf482

Browse files
BENCH-269 added @Injectmocks to CategoryServiceTest
1 parent 0d5514e commit 3faf482

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/test/java/com/answerdigital/answerking/service/CategoryServiceTest.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.junit.jupiter.api.BeforeEach;
1717
import org.junit.jupiter.api.Test;
1818
import org.junit.jupiter.api.extension.ExtendWith;
19+
import org.mockito.InjectMocks;
1920
import org.mockito.Mock;
2021
import org.mockito.junit.jupiter.MockitoExtension;
2122

@@ -34,6 +35,7 @@
3435
@ExtendWith(MockitoExtension.class)
3536
final class CategoryServiceTest {
3637

38+
@InjectMocks
3739
private CategoryService categoryService;
3840

3941
@Mock
@@ -56,16 +58,6 @@ private CategoryServiceTest() {
5658
productTestBuilder = new ProductTestBuilder();
5759
}
5860

59-
@BeforeEach
60-
void setUp() {
61-
categoryService = new CategoryService(productService, categoryRepository);
62-
}
63-
64-
@AfterEach
65-
void tearDown() {
66-
categoryService = null;
67-
}
68-
6961
@Test
7062
void testAddCategory() {
7163
// given

0 commit comments

Comments
 (0)