@Test
  public synchronized void storeAndUpdateJob() {
    this.clearDatabase();

    long docSizesBefore = FamCouchDBDao.getInstance().documentCount();

    int step = 1;

    TimeBooking booking = TeztBeanSimpleFactory.getNewValidBooking();
    booking.setBooked();
    booking.insert();

    Job document = new Job();
    document.setJobId(booking.getId());
    document.setUsername("foo");
    document.setStep(step);
    document.setIdJobDataProcessing("foo");
    document.setJobSurvey(new JSONObject());
    assertTrue(FamCouchDBDao.getInstance().createDocument(document));

    Job back = CouchDBDao4Jobs.me().getJob(booking.getId(), step);
    assertNotNull(back);
    long createdBefore = back.getCreated();
    assertEquals(back.getIdJobDataProcessing(), "foo");
    assertEquals(docSizesBefore + 1, FamCouchDBDao.getInstance().documentCount());

    document.setIdJobDataProcessing("bar");
    document.insertOrUpdate();
    back = CouchDBDao4Jobs.me().getJob(booking.getId(), step);
    assertNotNull(back);
    assertTrue(createdBefore != back.getCreated());
    assertEquals(back.getIdJobDataProcessing(), "bar");
    assertEquals(docSizesBefore + 1, FamCouchDBDao.getInstance().documentCount());
  }
 /** return the form template the user filled out and the job survey matches to. */
 @Override
 public JobDataProcessing process(Job datum) {
   JobDataProcessing result = null;
   if (datum.getIdJobDataProcessing() != null) {
     result =
         FamCouchDBDao.getInstance()
             .getOne(datum.getIdJobDataProcessing(), JobDataProcessing.class);
   }
   return result;
 }