Beispiel #1
0
  @Test
  public void testCheckInventoryIdUnique() throws BiobankCheckException, Exception {
    SpecimenWrapper duplicate =
        SpecimenHelper.newSpecimen(
            parentSpc,
            childSpc.getSpecimenType(),
            ActivityStatus.ACTIVE,
            childSpc.getProcessingEvent(),
            childSpc.getParentContainer(),
            2,
            2);

    duplicate.setInventoryId(parentSpc.getInventoryId());
    try {
      duplicate.checkInventoryIdUnique();
      Assert.fail("The check should detect that this is the same");
    } catch (DuplicateEntryException e) {
      Assert.assertTrue(true);
    }
  }
Beispiel #2
0
  @Test
  public void testCheckInventoryIdUniqueCaseSensitive() throws BiobankCheckException, Exception {
    int i = r.nextInt();
    parentSpc.setInventoryId("toto" + i);
    parentSpc.persist();
    SpecimenWrapper duplicate =
        SpecimenHelper.newSpecimen(
            parentSpc,
            childSpc.getSpecimenType(),
            ActivityStatus.ACTIVE,
            childSpc.getProcessingEvent(),
            childSpc.getParentContainer(),
            2,
            2);

    duplicate.setInventoryId("TOTO" + i);
    try {
      duplicate.checkInventoryIdUnique();
      Assert.assertTrue(true);
    } catch (BiobankCheckException bce) {
      Assert.fail("InventoryId is case sensitive. Should not fail");
    }
  }