-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60fbadb
commit 1e54ae6
Showing
7 changed files
with
57 additions
and
10 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
2 changes: 1 addition & 1 deletion
2
...main/java/global/packet/magellan/Api.java → ...lobal/packet/magellan/controller/Api.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package global.packet.magellan; | ||
package global.packet.magellan.controller; | ||
|
||
|
||
public class Api { | ||
|
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
5 changes: 3 additions & 2 deletions
5
...l/packet/magellan/ApplicationService.java → .../magellan/service/ApplicationService.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
2 changes: 1 addition & 1 deletion
2
...ket/magellan/ApplicationServiceLocal.java → ...llan/service/ApplicationServiceLocal.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
34 changes: 34 additions & 0 deletions
34
magellan-nbi/src/test/java/global/packet/magellan/ForwardingControllerTest.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,34 @@ | ||
package global.packet.magellan; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mockito; | ||
import org.mockito.MockitoAnnotations; | ||
|
||
import global.packet.magellan.controller.ForwardingController; | ||
|
||
public class ForwardingControllerTest { | ||
// controller is unmocked, but service bean inside is mocked | ||
private @InjectMocks ForwardingController controller = Mockito.mock(ForwardingController.class); | ||
// if controller is InjectMocked then Mock service bean will be injected | ||
//@Mock ForwardingController controller; | ||
|
||
@Before | ||
public void setup() { | ||
MockitoAnnotations.initMocks(this); | ||
} | ||
|
||
@Test | ||
public void testForwardRequest() { | ||
String expected = "ok"; | ||
Mockito.when(controller.getHealth()) | ||
.thenReturn(expected); | ||
String response = controller.getHealth(); | ||
Assertions.assertNotNull(response); | ||
Assert.assertEquals(expected, response); | ||
} | ||
|
||
} |