@Test
public void testChangeAnnotation() throws Exception {

  // Add an annotation
  AnnotationImpl a1 = new AnnotationImpl();
  a1.setInpoint(10);
  a1.setOutpoint(100);
  a1.setMediapackageId("mp123");
  a1.setSessionId("session123");
  a1.setType("ugc");
  a1.setValue("This is some user generated content");
  annotationService.addAnnotation(a1);
  Long a1Id = a1.getAnnotationId();
  AnnotationImpl a2 = new AnnotationImpl();
  a2.setAnnotationId(a1Id);
  a2.setValue("This is some other user generated content");
  Annotation a3 = annotationService.changeAnnotation(a2);
  Assert.assertNotNull(a3);
  Long a2Id = a2.getAnnotationId();
  Assert.assertEquals(a1Id, a2Id);
  Annotation a1FromDb = annotationService.getAnnotation(a1Id);
  Assert.assertEquals(a1.getAnnotationId(), a1FromDb.getAnnotationId());
  Assert.assertEquals(a2.getValue(), a1FromDb.getValue());
  Assert.assertEquals(a1.getSessionId(), a1FromDb.getSessionId());
  Assert.assertEquals(a1.getUserId(), a1FromDb.getUserId());
  Assert.assertEquals(a1.getUserId(), annotationService.securityService.getUser().getUsername());
  // remove annotation
  Assert.assertTrue(annotationService.removeAnnotation(a1));
}