@Test(expected = InvalidModelException.class)
 public void testCreateS3AttachmentTokenBadMD5()
     throws NumberFormatException, DatastoreException, NotFoundException, UnauthorizedException,
         InvalidModelException {
   S3AttachmentToken startToken = new S3AttachmentToken();
   startToken.setFileName("SomeFile.jpg");
   String almostMd5 = "79054025255fb1a26e4bc422aef";
   startToken.setMd5(almostMd5);
   Long tokenId = new Long(456);
   String entityId = "132";
   String userId = "007";
   String expectedPath = entityId + "/" + tokenId.toString();
   String expectePreSigneUrl = "I am a presigned url! whooot!";
   when(mocIdGenerator.generateNewId()).thenReturn(tokenId);
   Credentials mockCreds = Mockito.mock(Credentials.class);
   when(mockUuserManager.getUserInfo(userId)).thenReturn(mockUser);
   when(mockPermissionsManager.hasAccess(entityId, ACCESS_TYPE.UPDATE, mockUser)).thenReturn(true);
   when(mocKLocationHelper.createFederationTokenForS3(userId, HttpMethod.PUT, expectedPath))
       .thenReturn(mockCreds);
   when(mocKLocationHelper.presignS3PUTUrl(mockCreds, expectedPath, almostMd5, "image/jpeg"))
       .thenReturn(expectePreSigneUrl);
   // Make the actual call
   S3AttachmentToken endToken = manager.createS3AttachmentToken(userId, entityId, startToken);
   assertNotNull(endToken);
   assertEquals(expectePreSigneUrl, endToken.getPresignedUrl());
 }
  @Before
  public void setUp() throws DatastoreException, InvalidModelException, NotFoundException {
    // create a node
    Node toCreate = NodeTestUtils.createNew(name, userId);
    toCreate.setVersionComment("This is the first version of the first node ever!");
    toCreate.setVersionLabel("0.0.1");
    nodeId = nodeDAO.createNew(toCreate).substring(3); // trim "syn" from node ID

    // Initialize a new Evaluation
    EvaluationDBO evaluation = new EvaluationDBO();
    evaluation.setId(evalId);
    evaluation.seteTag("etag");
    evaluation.setName("name");
    evaluation.setOwnerId(userId);
    evaluation.setContentSource(KeyFactory.ROOT_ID);
    evaluation.setCreatedOn(System.currentTimeMillis());
    evaluation.setStatusEnum(EvaluationStatus.PLANNED);
    evalId = dboBasicDao.createNew(evaluation).getId();

    // Initialize a new Participant
    ParticipantDBO participant = new ParticipantDBO();
    participant.setUserId(userId);
    participant.setEvalId(evalId);
    participant.setCreatedOn(System.currentTimeMillis());
    participant.setId(idGenerator.generateNewId(TYPE.PARTICIPANT_ID));
    dboBasicDao.createNew(participant);

    // Initialize a new Submission
    SubmissionDBO submission = new SubmissionDBO();
    submission.setId(submissionId);
    submission.setName(name);
    submission.setEntityId(Long.parseLong(nodeId));
    submission.setVersionNumber(1L);
    submission.setUserId(userId);
    submission.setEvalId(evalId);
    submission.setCreatedOn(System.currentTimeMillis());
    dboBasicDao.createNew(submission);
  }