List of usage examples for java.time Instant isBefore
public boolean isBefore(Instant otherInstant)
From source file:org.noorganization.instalist.server.api.TagResourceTest.java
@Test public void testDeleteTag() throws Exception { String url = "/groups/%d/tags/%s"; Instant preDelete = mTag.getUpdated(); Response notAuthorizedResponse = target(String.format(url, mGroup.getId(), mTag.getUUID().toString())) .request().delete();//from www. ja va 2 s. c om assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mTag.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").delete(); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target(String.format(url, mNAGroup.getId(), mNATag.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNATag.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(404, wrongListResponse.getStatus()); Response okResponse = target(String.format(url, mGroup.getId(), mTag.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(200, okResponse.getStatus()); TypedQuery<Tag> savedTagQuery = mManager .createQuery("select t from Tag t where " + "t.group = :group and t.UUID = :uuid", Tag.class); savedTagQuery.setParameter("group", mGroup); savedTagQuery.setParameter("uuid", mTag.getUUID()); List<Tag> savedTag = savedTagQuery.getResultList(); assertEquals(0, savedTag.size()); TypedQuery<DeletedObject> savedDeletedTagQuery = mManager.createQuery( "select do from " + "DeletedObject do where do.group = :group and do.UUID = :uuid and do.type = :type", DeletedObject.class); savedDeletedTagQuery.setParameter("group", mGroup); savedDeletedTagQuery.setParameter("uuid", mTag.getUUID()); savedDeletedTagQuery.setParameter("type", DeletedObject.Type.TAG); List<DeletedObject> savedDeletedTags = savedDeletedTagQuery.getResultList(); assertEquals(1, savedDeletedTags.size()); assertTrue(preDelete.isBefore(savedDeletedTags.get(0).getUpdated())); }
From source file:org.noorganization.instalist.server.api.UnitResourceTest.java
@Test public void testDeleteUnit() throws Exception { String url = "/groups/%d/units/%s"; Instant preDelete = mUnit.getUpdated(); Response notAuthorizedResponse = target(String.format(url, mGroup.getId(), mUnit.getUUID().toString())) .request().delete();// w ww. java2 s .c o m assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mUnit.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").delete(); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target(String.format(url, mNAGroup.getId(), mNAUnit.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNAUnit.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(404, wrongListResponse.getStatus()); Response okResponse = target(String.format(url, mGroup.getId(), mUnit.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(200, okResponse.getStatus()); TypedQuery<Unit> savedUnitQuery = mManager .createQuery("select u from Unit u where " + "u.group = :group and u.UUID = :uuid", Unit.class); savedUnitQuery.setParameter("group", mGroup); savedUnitQuery.setParameter("uuid", mUnit.getUUID()); List<Unit> savedUnits = savedUnitQuery.getResultList(); assertEquals(0, savedUnits.size()); TypedQuery<DeletedObject> savedDeletedUnitQuery = mManager.createQuery( "select do from " + "DeletedObject do where do.group = :group and do.UUID = :uuid and do.type = :type", DeletedObject.class); savedDeletedUnitQuery.setParameter("group", mGroup); savedDeletedUnitQuery.setParameter("uuid", mUnit.getUUID()); savedDeletedUnitQuery.setParameter("type", DeletedObject.Type.UNIT); List<DeletedObject> savedDeletedUnits = savedDeletedUnitQuery.getResultList(); assertEquals(1, savedDeletedUnits.size()); assertTrue(preDelete.isBefore(savedDeletedUnits.get(0).getUpdated())); }
From source file:org.noorganization.instalist.server.api.RecipeResourceTest.java
@Test public void testDeleteRecipe() throws Exception { String url = "/groups/%d/recipes/%s"; Instant preDelete = mRecipe.getUpdated(); Response notAuthorizedResponse = target(String.format(url, mGroup.getId(), mRecipe.getUUID().toString())) .request().delete();//from www. j a v a 2s .c o m assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mRecipe.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").delete(); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target(String.format(url, mNAGroup.getId(), mNARecipe.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNARecipe.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(404, wrongListResponse.getStatus()); Response okResponse = target(String.format(url, mGroup.getId(), mRecipe.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(200, okResponse.getStatus()); TypedQuery<Recipe> savedRecipeQuery = mManager .createQuery("select r from Recipe r where " + "r.group = :group and r.UUID = :uuid", Recipe.class); savedRecipeQuery.setParameter("group", mGroup); savedRecipeQuery.setParameter("uuid", mRecipe.getUUID()); List<Recipe> savedRecipes = savedRecipeQuery.getResultList(); assertEquals(0, savedRecipes.size()); TypedQuery<DeletedObject> savedDeletedUnitQuery = mManager.createQuery( "select do from " + "DeletedObject do where do.group = :group and do.UUID = :uuid and do.type = :type", DeletedObject.class); savedDeletedUnitQuery.setParameter("group", mGroup); savedDeletedUnitQuery.setParameter("uuid", mRecipe.getUUID()); savedDeletedUnitQuery.setParameter("type", DeletedObject.Type.RECIPE); List<DeletedObject> savedDeletedRecipes = savedDeletedUnitQuery.getResultList(); assertEquals(1, savedDeletedRecipes.size()); assertTrue(preDelete.isBefore(savedDeletedRecipes.get(0).getUpdated())); }
From source file:org.noorganization.instalist.server.api.EntryResourceTest.java
@Test public void testDeleteEntry() throws Exception { String url = "/groups/%d/listentries/%s"; Instant preDelete = mEntry.getUpdated(); Response notAuthorizedResponse = target(String.format(url, mGroup.getId(), mEntry.getUUID().toString())) .request().delete();/* w w w . j a v a 2 s . c o m*/ assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mEntry.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").delete(); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target(String.format(url, mNAGroup.getId(), mNAEntry.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNAEntry.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(404, wrongListResponse.getStatus()); Response okResponse = target(String.format(url, mGroup.getId(), mEntry.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(200, okResponse.getStatus()); TypedQuery<ListEntry> savedEntryQuery = mManager.createQuery( "select le from ListEntry le " + "where le.group = :group and le.UUID = :uuid", ListEntry.class); savedEntryQuery.setParameter("group", mGroup); savedEntryQuery.setParameter("uuid", mEntry.getUUID()); List<ListEntry> savedEntries = savedEntryQuery.getResultList(); assertEquals(0, savedEntries.size()); TypedQuery<DeletedObject> savedDeletedEntryQuery = mManager.createQuery("select do " + "from DeletedObject do where do.group = :group and do.UUID = :uuid and " + "do.type = :type", DeletedObject.class); savedDeletedEntryQuery.setParameter("group", mGroup); savedDeletedEntryQuery.setParameter("uuid", mEntry.getUUID()); savedDeletedEntryQuery.setParameter("type", DeletedObject.Type.LISTENTRY); List<DeletedObject> savedDeletedEntries = savedDeletedEntryQuery.getResultList(); assertEquals(1, savedDeletedEntries.size()); assertTrue(preDelete.isBefore(savedDeletedEntries.get(0).getUpdated())); }
From source file:org.noorganization.instalist.server.api.ProductResourceTest.java
@Test public void testDeleteProduct() throws Exception { String url = "/groups/%d/products/%s"; Instant preDelete = mProduct.getUpdated(); Response notAuthorizedResponse = target(String.format(url, mGroup.getId(), mProduct.getUUID().toString())) .request().delete();/* www . ja va2 s.co m*/ assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mProduct.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").delete(); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target(String.format(url, mNAGroup.getId(), mNAProduct.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNAProduct.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(404, wrongListResponse.getStatus()); Response okResponse = target(String.format(url, mGroup.getId(), mProduct.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(200, okResponse.getStatus()); TypedQuery<Product> savedUnitQuery = mManager.createQuery( "select p from Product p where " + "p.group = :group and p.UUID = :uuid", Product.class); savedUnitQuery.setParameter("group", mGroup); savedUnitQuery.setParameter("uuid", mProduct.getUUID()); List<Product> savedProducts = savedUnitQuery.getResultList(); assertEquals(0, savedProducts.size()); TypedQuery<DeletedObject> savedDeletedProductQuery = mManager.createQuery("select do " + "from DeletedObject do where do.group = :group and do.UUID = :uuid and " + "do.type = :type", DeletedObject.class); savedDeletedProductQuery.setParameter("group", mGroup); savedDeletedProductQuery.setParameter("uuid", mProduct.getUUID()); savedDeletedProductQuery.setParameter("type", DeletedObject.Type.PRODUCT); List<DeletedObject> savedDeletedUnits = savedDeletedProductQuery.getResultList(); assertEquals(1, savedDeletedUnits.size()); assertTrue(preDelete.isBefore(savedDeletedUnits.get(0).getUpdated())); }
From source file:org.noorganization.instalist.server.api.ListResourceTest.java
@Test public void testDeleteList() throws Exception { String url = "/groups/%d/lists/%s"; Instant preDelete = mListWC.getUpdated(); Response notAuthorizedResponse = target(String.format(url, mGroup.getId(), mListWC.getUUID().toString())) .request().delete();//www. ja v a 2s . c o m assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mListWC.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").delete(); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target(String.format(url, mNAGroup.getId(), mNAList.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNAList.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(404, wrongListResponse.getStatus()); Thread.sleep(300); Response okResponse = target(String.format(url, mGroup.getId(), mListWC.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(200, okResponse.getStatus()); TypedQuery<ShoppingList> savedListQuery = mManager.createQuery( "select sl from " + "ShoppingList sl where sl.group = :group and sl.UUID = :uuid", ShoppingList.class); savedListQuery.setParameter("group", mGroup); savedListQuery.setParameter("uuid", mListWC.getUUID()); List<ShoppingList> savedLists = savedListQuery.getResultList(); assertEquals(0, savedLists.size()); TypedQuery<DeletedObject> savedDeletedListQuery = mManager.createQuery( "select do from " + "DeletedObject do where do.group = :group and do.UUID = :uuid", DeletedObject.class); savedDeletedListQuery.setParameter("group", mGroup); savedDeletedListQuery.setParameter("uuid", mListWC.getUUID()); List<DeletedObject> savedDeletedLists = savedDeletedListQuery.getResultList(); assertEquals(1, savedDeletedLists.size()); assertTrue(preDelete + " vs. " + savedDeletedLists.get(0).getUpdated(), preDelete.isBefore(savedDeletedLists.get(0).getUpdated())); }
From source file:org.noorganization.instalist.server.api.IngredientResourceTest.java
@Test public void testDeleteIngredient() throws Exception { String url = "/groups/%d/ingredients/%s"; Instant preDelete = mIngredient.getUpdated(); Response notAuthorizedResponse = target( String.format(url, mGroup.getId(), mIngredient.getUUID().toString())).request().delete(); assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mIngredient.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").delete(); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target( String.format(url, mNAGroup.getId(), mNAIngredient.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNAIngredient.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(404, wrongListResponse.getStatus()); Response okResponse = target(String.format(url, mGroup.getId(), mIngredient.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete(); assertEquals(200, okResponse.getStatus()); TypedQuery<Ingredient> savedIngredientQuery = mManager.createQuery( "select i from " + "Ingredient i where i.group = :group and i.UUID = :uuid", Ingredient.class); savedIngredientQuery.setParameter("group", mGroup); savedIngredientQuery.setParameter("uuid", mIngredient.getUUID()); List<Ingredient> savedIngredients = savedIngredientQuery.getResultList(); assertEquals(0, savedIngredients.size()); TypedQuery<DeletedObject> savedDeletedEntryQuery = mManager.createQuery("select do " + "from DeletedObject do where do.group = :group and do.UUID = :uuid and " + "do.type = :type", DeletedObject.class); savedDeletedEntryQuery.setParameter("group", mGroup); savedDeletedEntryQuery.setParameter("uuid", mIngredient.getUUID()); savedDeletedEntryQuery.setParameter("type", DeletedObject.Type.INGREDIENT); List<DeletedObject> savedDeletedEntries = savedDeletedEntryQuery.getResultList(); assertEquals(1, savedDeletedEntries.size()); assertTrue(preDelete.isBefore(savedDeletedEntries.get(0).getUpdated())); }
From source file:org.noorganization.instalist.server.api.TagResourceTest.java
@Test public void testPutTag() throws Exception { String url = "/groups/%d/tags/%s"; Instant preUpdate = mTag.getUpdated(); TagInfo updatedList = new TagInfo().withDeleted(false).withName("changedtag"); Response notAuthorizedResponse = target(String.format(url, mGroup.getId(), mTag.getUUID().toString())) .request().put(Entity.json(updatedList)); assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mTag.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").put(Entity.json(updatedList)); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target(String.format(url, mNAGroup.getId(), mNATag.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNATag.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(404, wrongListResponse.getStatus()); Response goneResponse = target(String.format(url, mGroup.getId(), mDeletedTag.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(410, goneResponse.getStatus()); mManager.refresh(mTag);//from ww w . j ava 2s . com assertEquals("tag1", mTag.getName()); updatedList.setLastChanged(new Date(preUpdate.toEpochMilli() - 10000)); Response conflictResponse = target(String.format(url, mGroup.getId(), mTag.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(409, conflictResponse.getStatus()); mManager.refresh(mTag); assertEquals("tag1", mTag.getName()); updatedList.setLastChanged(Date.from(Instant.now())); Response okResponse = target(String.format(url, mGroup.getId(), mTag.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(200, okResponse.getStatus()); mManager.refresh(mTag); assertEquals("changedtag", mTag.getName()); assertTrue(preUpdate + " is not before " + mTag.getUpdated(), preUpdate.isBefore(mTag.getUpdated())); }
From source file:org.noorganization.instalist.server.api.UnitResourceTest.java
@Test public void testPutUnit() throws Exception { String url = "/groups/%d/units/%s"; Instant preUpdate = mUnit.getUpdated(); UnitInfo updatedList = new UnitInfo().withDeleted(false).withName("changedunit"); Response notAuthorizedResponse = target(String.format(url, mGroup.getId(), mUnit.getUUID().toString())) .request().put(Entity.json(updatedList)); assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mUnit.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").put(Entity.json(updatedList)); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target(String.format(url, mNAGroup.getId(), mNAUnit.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNAUnit.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(404, wrongListResponse.getStatus()); Response goneResponse = target(String.format(url, mGroup.getId(), mDeletedUnit.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(410, goneResponse.getStatus()); mManager.refresh(mUnit);// w ww .ja v a2 s.c o m assertEquals("unit1", mUnit.getName()); updatedList.setLastChanged(new Date(preUpdate.toEpochMilli() - 10000)); Response conflictResponse = target(String.format(url, mGroup.getId(), mUnit.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(409, conflictResponse.getStatus()); mManager.refresh(mUnit); assertEquals("unit1", mUnit.getName()); updatedList.setLastChanged(Date.from(Instant.now())); Response okResponse = target(String.format(url, mGroup.getId(), mUnit.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedList)); assertEquals(200, okResponse.getStatus()); mManager.refresh(mUnit); assertEquals("changedunit", mUnit.getName()); assertTrue(preUpdate + " is not before " + mUnit.getUpdated(), preUpdate.isBefore(mUnit.getUpdated())); }
From source file:org.noorganization.instalist.server.api.EntryResourceTest.java
@Test public void testPutEntry() throws Exception { String url = "/groups/%d/listentries/%s"; Instant preUpdate = mEntry.getUpdated(); EntryInfo updatedEntry = new EntryInfo().withAmount(3f); Response notAuthorizedResponse = target(String.format(url, mGroup.getId(), mEntry.getUUID().toString())) .request().put(Entity.json(updatedEntry)); assertEquals(401, notAuthorizedResponse.getStatus()); Response wrongAuthResponse = target(String.format(url, mGroup.getId(), mEntry.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongauth").put(Entity.json(updatedEntry)); assertEquals(401, wrongAuthResponse.getStatus()); Response wrongGroupResponse = target(String.format(url, mNAGroup.getId(), mNAEntry.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedEntry)); assertEquals(401, wrongGroupResponse.getStatus()); Response wrongListResponse = target(String.format(url, mGroup.getId(), mNAEntry.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedEntry)); assertEquals(404, wrongListResponse.getStatus()); Response goneResponse = target(String.format(url, mGroup.getId(), mDeletedEntry.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedEntry)); assertEquals(410, goneResponse.getStatus()); mManager.refresh(mEntry);/*from w w w . j a v a 2 s . co m*/ assertEquals(1f, mEntry.getAmount(), 0.001f); updatedEntry.setLastChanged(new Date(preUpdate.toEpochMilli() - 10000)); Response conflictResponse = target(String.format(url, mGroup.getId(), mEntry.getUUID().toString())) .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedEntry)); assertEquals(409, conflictResponse.getStatus()); mManager.refresh(mEntry); assertEquals(1f, mEntry.getAmount(), 0.001f); updatedEntry.setLastChanged(Date.from(Instant.now())); Response okResponse = target(String.format(url, mGroup.getId(), mEntry.getUUID().toString())).request() .header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).put(Entity.json(updatedEntry)); assertEquals(200, okResponse.getStatus()); mManager.refresh(mEntry); assertEquals(3f, mEntry.getAmount(), 0.001f); assertTrue(preUpdate + " is not before " + mEntry.getUpdated(), preUpdate.isBefore(mEntry.getUpdated())); }