-
Notifications
You must be signed in to change notification settings - Fork 212
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
7ab60a1
commit 25a4548
Showing
4 changed files
with
73 additions
and
9 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
56 changes: 56 additions & 0 deletions
56
micro-grizzly-with-jersey/src/test/java/app/root/context/single/RootSingleClassTest.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,56 @@ | ||
package app.root.context.single; | ||
|
||
import com.oath.micro.server.MicroserverApp; | ||
import com.oath.micro.server.auto.discovery.RestResource; | ||
import com.oath.micro.server.config.Microserver; | ||
import com.oath.micro.server.testing.RestAgent; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
@Microserver | ||
@Path("/single") | ||
public class RootSingleClassTest implements RestResource{ | ||
|
||
RestAgent rest = new RestAgent(); | ||
|
||
MicroserverApp server; | ||
@Before | ||
public void startServer(){ | ||
|
||
server = new MicroserverApp( RootSingleClassTest.class, ()-> ""); | ||
server.start(); | ||
|
||
} | ||
|
||
@After | ||
public void stopServer(){ | ||
server.stop(); | ||
} | ||
|
||
@Test | ||
public void runAppAndBasicTest() throws InterruptedException, ExecutionException{ | ||
|
||
|
||
|
||
assertThat(rest.get("http://localhost:8080/single/ping"),is("ok")); | ||
|
||
} | ||
|
||
@GET | ||
@Produces("text/plain") | ||
@Path("/ping") | ||
public String ping() { | ||
return "ok"; | ||
} | ||
|
||
|
||
} |
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