@Test public void testGetSpawnedItemByLevel() { Item item = wr.path("items/spawner").queryParam("level", "25").get(Item.class); Assert.assertEquals("MyBracer", item.getName()); Assert.assertEquals("Bracer", item.getSlot()); Assert.assertEquals(Integer.valueOf(25), item.getLevel()); }
@Test public void testUpdateItemProduces204() { Item itemToUpdate = DomainObjectUtils.createItemObject( "Spectral Shield", "offhand", 20.0, 35.0, 10.0, 1, 43, 1200.0, 76.0, 40.0); itemToUpdate.setId(5000000L); ClientResponse response = wr.path("items/5000000").put(ClientResponse.class, itemToUpdate); Assert.assertEquals(204, response.getStatus()); }
@Test public void testCreateItemWithSpecifiedIdProduces400() { Item itemToCreate = DomainObjectUtils.createItemObject( "Spectral Shield", "offhand", 20.0, 35.0, 10.0, 1, 43, 1200.0, 76.0, 40.0); itemToCreate.setId(500L); ClientResponse response = wr.path("items").post(ClientResponse.class, itemToCreate); Assert.assertEquals(400, response.getStatus()); }
@Test public void testGetItemById() { Item item = wr.path("items/5000000").get(ClientResponse.class).getEntity(Item.class); Assert.assertEquals(Long.valueOf(5000000L), item.getId()); Assert.assertEquals("MyBracer", item.getName()); Assert.assertEquals("Bracer", item.getSlot()); Assert.assertEquals(Double.valueOf(1600.0), item.getMindamage()); Assert.assertEquals(Double.valueOf(1450.0), item.getMaxdamage()); Assert.assertEquals(Double.valueOf(90.0), item.getCritchance()); Assert.assertEquals(Integer.valueOf(2), item.getAtkspeed()); Assert.assertEquals(Double.valueOf(99.9), item.getDefense()); Assert.assertEquals(Double.valueOf(99.8), item.getAbsorption()); Assert.assertEquals(Double.valueOf(99.7), item.getBlockchance()); Assert.assertEquals(Integer.valueOf(30), item.getLevel()); }
@Test public void testGetSpawnedItemBySlot() { Item item = wr.path("items/spawner").queryParam("slot", "Bracer").get(Item.class); Assert.assertEquals("MyBracer", item.getName()); Assert.assertEquals("Bracer", item.getSlot()); }