Work on tests

This commit is contained in:
James Agnew 2019-01-04 13:05:39 -05:00
parent f39cf58a4a
commit 051074d0bc
2 changed files with 6 additions and 6 deletions

View File

@ -59,6 +59,8 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.PostConstruct;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
@ -378,7 +380,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
} else if (match.size() == 1) {
Long pid = match.iterator().next();
entity = myEntityManager.find(ResourceTable.class, pid);
return toMethodOutcome(entity, theResource).setCreated(false);
return toMethodOutcome(entity, null).setCreated(false);
}
}
@ -1139,11 +1141,9 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
return retVal;
}
private DaoMethodOutcome toMethodOutcome(final ResourceTable theEntity, IBaseResource theResource) {
private DaoMethodOutcome toMethodOutcome(@Nonnull final ResourceTable theEntity, @Nullable IBaseResource theResource) {
DaoMethodOutcome outcome = new DaoMethodOutcome();
// FIXME: can theResource ever be null? why?
IIdType id = null;
if (theResource != null) {
id = theResource.getIdElement();
@ -1294,7 +1294,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
* directly. So we just bail now.
*/
if (!thePerformIndexing) {
DaoMethodOutcome outcome = toMethodOutcome(entity, theResource).setCreated(false);
DaoMethodOutcome outcome = toMethodOutcome(entity, null).setCreated(false);
outcome.setPreviousResource(oldResource);
return outcome;
}

View File

@ -2573,8 +2573,8 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
assertThat(nextEntry.getResponse().getLocation(), (containsString("test")));
assertEquals(id.toVersionless(), new IdType(nextEntry.getResponse().getLocation()).toVersionless());
assertNotEquals(id, new IdType(nextEntry.getResponse().getLocation()));
assertThat(nextEntry.getResponse().getLocation(), endsWith("/_history/2"));
assertNotEquals(id, new IdType(nextEntry.getResponse().getLocation()));
nextEntry = resp.getEntry().get(1);
assertEquals(Constants.STATUS_HTTP_201_CREATED + " Created", nextEntry.getResponse().getStatus());