-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differentiate unit, integration and e2e tests
- Loading branch information
flawmop
committed
Aug 18, 2024
1 parent
36b1267
commit 383b975
Showing
9 changed files
with
135 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rtal/svc/rip/FileProcessingException.java → ...ip/exception/FileProcessingException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ class RipSvcApplicationTests { | |
|
||
@Test | ||
void contextLoads() { | ||
|
||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
src/test-i/java/com/insilicosoft/portal/svc/rip/controller/FileSyncUploadControllerIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.insilicosoft.portal.svc.rip.controller; | ||
|
||
import static org.mockito.BDDMockito.given; | ||
import static org.mockito.Mockito.verify; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; | ||
import org.springframework.boot.test.mock.mockito.MockBean; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
|
||
import com.insilicosoft.portal.svc.rip.service.InputProcessorService; | ||
|
||
@WebMvcTest | ||
public class FileSyncUploadControllerIT { | ||
|
||
final static MediaType textWithCharset = new MediaType(MediaType.TEXT_PLAIN, StandardCharsets.UTF_8); | ||
|
||
@Autowired | ||
private MockMvc mockMvc; | ||
|
||
@MockBean | ||
private InputProcessorService mockInputProcessorService; | ||
|
||
@Test | ||
void testGet() throws Exception { | ||
final String getMessage = "Message from get!"; | ||
|
||
given(mockInputProcessorService.get()).willReturn(getMessage); | ||
|
||
mockMvc.perform(get("/run")) | ||
.andExpect(status().isOk()) | ||
.andExpect(content().contentType(textWithCharset)); | ||
|
||
verify(mockInputProcessorService).get(); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/test/java/com/insilicosoft/portal/svc/rip/exception/FileProcessingExceptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.insilicosoft.portal.svc.rip.exception; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class FileProcessingExceptionTest { | ||
|
||
@DisplayName("Test the initialising constructor") | ||
@Test | ||
void testConstructor() { | ||
final String message = "test exception message"; | ||
final FileProcessingException e = new FileProcessingException(message); | ||
assertEquals(message, e.getMessage()); | ||
} | ||
|
||
} |