tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 1 | package org.onlab.onos.rest; |
| 2 | |
| 3 | import com.sun.jersey.api.client.WebResource; |
| 4 | import com.sun.jersey.test.framework.JerseyTest; |
| 5 | import org.junit.BeforeClass; |
tom | 202175a | 2014-09-19 19:00:11 -0700 | [diff] [blame^] | 6 | import org.junit.Ignore; |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 7 | import org.junit.Test; |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 8 | |
| 9 | import static org.junit.Assert.assertTrue; |
| 10 | |
| 11 | /** |
| 12 | * Simple example on how to write a JAX-RS unit test using Jersey test framework. |
| 13 | * A base class should/will be created to provide further assistance for testing. |
| 14 | */ |
| 15 | public class GreetResourceTest extends JerseyTest { |
| 16 | |
| 17 | public GreetResourceTest() { |
| 18 | super("org.onlab.onos.rest"); |
| 19 | } |
| 20 | |
| 21 | @BeforeClass |
| 22 | public static void classSetUp() { |
tom | 202175a | 2014-09-19 19:00:11 -0700 | [diff] [blame^] | 23 | // ServiceDirectory testDirectory = |
| 24 | // new TestServiceDirectory().add(GreetService.class, new GreetManager()); |
| 25 | // GreetResource.setServiceDirectory(testDirectory); |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 26 | } |
| 27 | |
tom | 202175a | 2014-09-19 19:00:11 -0700 | [diff] [blame^] | 28 | @Ignore |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 29 | @Test |
| 30 | public void basics() { |
| 31 | WebResource rs = resource(); |
| 32 | String response = rs.path("greet").get(String.class); |
| 33 | assertTrue("incorrect response", response.contains("Whazup ")); |
| 34 | } |
| 35 | |
| 36 | } |