public void testCRUD() {
executeInTransaction(new TransactionCallback() {
@Override
public void execute() throws Exception {
Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
int entityId = savedSearchManager.createSavedSearch(subject, new SavedSearch(SearchSubsystem.GROUP,
"fake saved search", "pipo", subject));
SavedSearch entity = savedSearchManager.getSavedSearchById(subject, entityId);
assertNotNull(entity);
SavedSearch modifiedEntity = new SavedSearch(SearchSubsystem.RESOURCE, "fake saved search modified",
"molo", subject);
modifiedEntity.setId(entityId);
boolean updateSuccess = savedSearchManager.updateSavedSearch(subject, modifiedEntity);
assertTrue("Update save searched failed", updateSuccess);
savedSearchManager.deleteSavedSearch(subject, entityId);
assertNull(em.find(SavedSearch.class, entityId));
}