Skip to content

Commit

Permalink
Added skeleton for test case setup and cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
nhkhai committed Mar 24, 2024
1 parent 95bfc97 commit c3bf1b5
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.slf4j.Logger;
Expand All @@ -19,6 +23,27 @@ class SmartInventoryApplicationTests {
// trace(), debug(), info(), warn(), error().
private static final Logger test_logger = LoggerFactory.getLogger(SmartInventoryApplicationTests.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

}

@AfterEach
void teardown() {

}

@Test
void contextLoads() {
test_logger.info("Starting test: " + getCurrentMethodName() + ". ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -42,6 +44,16 @@ public class CustomerControllerTest {
private static final Logger test_logger = LoggerFactory.getLogger(CustomerControllerTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -42,6 +44,16 @@ public class ProductControllerTest {
private static final Logger test_logger = LoggerFactory.getLogger(ProductControllerTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -42,6 +44,16 @@ public class ReviewControllerTest {
private static final Logger test_logger = LoggerFactory.getLogger(ReviewControllerTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
12 changes: 12 additions & 0 deletions src/test/java/sg/com/smartinventory/entities/CustomerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -32,6 +34,16 @@ public class CustomerTest {
private static final Logger test_logger = LoggerFactory.getLogger(CustomerTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand All @@ -23,6 +25,16 @@ public class ErrorResponseTest {
private static final Logger test_logger = LoggerFactory.getLogger(ErrorResponseTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
12 changes: 12 additions & 0 deletions src/test/java/sg/com/smartinventory/entities/ProductTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -32,6 +34,16 @@ public class ProductTest {
private static final Logger test_logger = LoggerFactory.getLogger(ProductTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
12 changes: 12 additions & 0 deletions src/test/java/sg/com/smartinventory/entities/ReviewTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -32,6 +34,16 @@ public class ReviewTest {
private static final Logger test_logger = LoggerFactory.getLogger(ReviewTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -57,6 +59,16 @@ public class IntegrationTest {
private static final Logger test_logger = LoggerFactory.getLogger(IntegrationTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -39,6 +41,16 @@ public class CustomerServiceImplTest {
private static final Logger test_logger = LoggerFactory.getLogger(CustomerServiceImplTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -39,6 +41,16 @@ public class ProductServiceImplTest {
private static final Logger test_logger = LoggerFactory.getLogger(ProductServiceImplTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -39,6 +41,16 @@ public class ReviewServiceImplTest {
private static final Logger test_logger = LoggerFactory.getLogger(ReviewServiceImplTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
12 changes: 12 additions & 0 deletions src/test/java/sg/com/smartinventory/useCases/UseCaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -57,6 +59,16 @@ public class UseCaseTest {
private static final Logger test_logger = LoggerFactory.getLogger(UseCaseTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down
12 changes: 12 additions & 0 deletions src/test/java/sg/com/smartinventory/utility/DataLoaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -40,6 +42,16 @@ public class DataLoaderTest {
private static final Logger test_logger = LoggerFactory.getLogger(DataLoaderTest.class);

// Test Setup and Teardown configuration.
@BeforeAll
static void initAll() {

}

@AfterAll
static void teardownAll() {

}

@BeforeEach
void init() {

Expand Down

0 comments on commit c3bf1b5

Please sign in to comment.