use of org.activityinfo.legacy.shared.model.TargetDTO in project activityinfo by bedatadriven.
the class TargetTest method updateTarget.
@Test
public void updateTarget() throws Throwable {
LocalDate fromDate = new LocalDate(2015, 3, 3);
LocalDate toDate = new LocalDate(2015, 3, 4);
Map<String, Object> changes = new HashMap<String, Object>();
changes.put("name", "newNameOfTarget");
changes.put("fromDate", fromDate);
changes.put("toDate", toDate);
execute(new BatchCommand(new UpdateEntity("Target", 1, changes)));
List<TargetDTO> targets = execute(new GetTargets(db.getId())).getData();
TargetDTO dto = getTargetById(targets, 1);
assertThat(dto.getName(), equalTo("newNameOfTarget"));
assertThat(dto.getFromDate(), equalTo(fromDate));
assertThat(dto.getToDate(), equalTo(toDate));
}
use of org.activityinfo.legacy.shared.model.TargetDTO in project activityinfo by bedatadriven.
the class TargetTest method createTarget.
private TargetDTO createTarget() {
Date date1 = new Date();
Date date2 = new Date();
TargetDTO target = new TargetDTO();
target.setName("Target0071");
target.setFromDate(date1);
target.setToDate(date2);
return target;
}
use of org.activityinfo.legacy.shared.model.TargetDTO in project activityinfo by bedatadriven.
the class CommandValidatorTest method nameTooLong.
@Test
public void nameTooLong() {
TargetDTO target = new TargetDTO();
target.setName(Strings.repeat("xoxoxo", 2000));
AddTarget command = new AddTarget();
command.setTarget(target);
assertThat(validator.validate(command), hasItems(forProperty("target.name")));
}
use of org.activityinfo.legacy.shared.model.TargetDTO in project activityinfo by bedatadriven.
the class CommandValidatorTest method missingDates.
@Test
public void missingDates() {
TargetDTO target = new TargetDTO();
AddTarget command = new AddTarget();
command.setTarget(target);
assertThat(validator.validate(command), hasItems(forProperty("target.name"), forProperty("target.fromDate"), forProperty("target.toDate")));
}
Aggregations