use of example.Job in project elide by yahoo.
the class PersistentResourceTest method testCreateMappedIdObjectSuccess.
@Test()
public void testCreateMappedIdObjectSuccess() {
final Job job = new Job();
job.setTitle("day job");
job.setParent(newParent(1));
final RequestScope goodScope = buildRequestScope(tx, new TestUser("1"));
when(tx.createNewObject(ClassType.of(Job.class), goodScope)).thenReturn(job);
PersistentResource<Job> created = PersistentResource.createObject(ClassType.of(Job.class), goodScope, Optional.empty());
created.getRequestScope().getPermissionExecutor().executeCommitChecks();
assertEquals("day job", created.getObject().getTitle(), "The create function should return the requested job object");
assertNull(created.getObject().getJobId(), "The create function should not override the ID");
created = PersistentResource.createObject(ClassType.of(Job.class), goodScope, Optional.of("1234"));
created.getRequestScope().getPermissionExecutor().executeCommitChecks();
assertEquals("day job", created.getObject().getTitle(), "The create function should return the requested job object");
assertNull(created.getObject().getJobId(), "The create function should not override the ID");
}
Aggregations