use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method validateSenderTypeChangeTwo.
@Test
public void validateSenderTypeChangeTwo() throws Exception {
Transfer before = makeTransfer(makeGroup(1L), makeGroup(2L));
Transfer updated = copyTransfer(before);
updated.setSenderGroup(null);
updated.setSenderLab(makeLab(1L));
List<ValidationError> errors = validate(updated, before);
assertError(errors, "Cannot change sender between internal (group) and external (lab)");
}
use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method testValidateFirstReceipt.
@Test
public void testValidateFirstReceipt() throws Exception {
Transfer transfer = makeTransfer(makeLab(1L), makeGroup(1L));
addTransferSample(transfer, makeSample(1L));
List<ValidationError> errors = validate(transfer, null);
assertTrue(errors.isEmpty());
}
use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method validateRecipientTypeChangeOne.
@Test
public void validateRecipientTypeChangeOne() throws Exception {
Transfer before = makeTransfer(makeGroup(1L), makeGroup(2L));
Transfer updated = copyTransfer(before);
updated.setRecipientGroup(null);
updated.setRecipient("Recipient");
List<ValidationError> errors = validate(updated, before);
assertError(errors, "Cannot change recipient between internal (group) and external (named)");
}
use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method testValidateSingleReceipt.
@Test
public void testValidateSingleReceipt() throws Exception {
Sample sample = makeSample(1L);
Transfer previousReceipt = makeTransfer(makeLab(1L), makeGroup(1L));
previousReceipt.setId(1L);
addTransferSample(previousReceipt, sample);
Transfer transfer = makeTransfer(makeLab(1L), makeGroup(1L));
addTransferSample(transfer, sample);
List<ValidationError> errors = validate(transfer, null);
assertError(errors, "Items can only have one receipt (external lab to internal group) transfer");
}
use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method validateRecipientGroupChangeAllowed.
@Test
public void validateRecipientGroupChangeAllowed() throws Exception {
Group group1 = makeGroup(1L);
setUser(false, group1);
Transfer before = makeTransfer(group1, makeGroup(2L));
Transfer updated = copyTransfer(before);
updated.setRecipientGroup(makeGroup(3L));
List<ValidationError> errors = validate(updated, before);
assertNoError(errors, "Only administrators and members of the sender group can change recipient group");
}
Aggregations