SHARE
TWEET

Untitled

a guest Dec 14th, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import dependencyBinder.TestDepBinder;
  3. import htwb.ai.mm.bean.Song;
  4. import org.glassfish.jersey.server.ResourceConfig;
  5. import org.glassfish.jersey.test.JerseyTest;
  6. import org.junit.Assert;
  7. import org.junit.jupiter.api.AfterEach;
  8. import org.junit.jupiter.api.BeforeEach;
  9. import org.junit.jupiter.api.Test;
  10.  
  11. import javax.ws.rs.client.Entity;
  12. import javax.ws.rs.core.*;
  13.  
  14.  
  15. import java.util.Map;
  16. import java.util.concurrent.ConcurrentHashMap;
  17.  
  18.  
  19. class SongsWebServiceTest extends JerseyTest {
  20.  
  21.  
  22.     @Override
  23.     protected Application configure() {
  24.         return new ResourceConfig(SongsWebService.class).register(new TestDepBinder());
  25.     }
  26.  
  27.     @BeforeEach
  28.     @Override
  29.     public void setUp() throws Exception {
  30.         super.setUp();
  31.     }
  32.  
  33.     @AfterEach
  34.     @Override
  35.     public void tearDown() throws Exception {
  36.         super.tearDown();
  37.     }
  38.  
  39.     @Test
  40.     void updateSong() {
  41.     }
  42.  
  43.     @Test
  44.     void deleteSong() {
  45.     }
  46.  
  47.     @Test
  48.     public void createSongShouldReturn201AndId() {
  49.         Song song = new Song();
  50.         song.setTitle("Test");
  51.         song.setId(2);
  52.         Response response = target("/songs").request().post(Entity.xml(song));
  53.         Assert.assertEquals(201, response.getStatus());
  54.         Assert.assertTrue(response.getLocation().toString().endsWith("2"));
  55.     }
  56.  
  57. //    @Test
  58. //    public void createSongShouldReturn400() {
  59. //        Song song = new Song();
  60. //        song.setTitle("Test");
  61. //        Response response = target("/songs").request().post(Entity.xml(song));
  62. //        Assert.assertEquals(201, response.getStatus());
  63. //        Assert.assertTrue(response.getLocation().toString().endsWith("2"));
  64. //    }
  65. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top