Fix a few unit tests

This commit is contained in:
James Agnew 2014-07-07 12:42:37 -04:00
parent 46828030db
commit b1a602d88b
5 changed files with 9 additions and 4 deletions

View File

@ -146,7 +146,7 @@ public class DefaultThymeleafNarrativeGeneratorTest {
String title = gen.generateTitle(value);
ourLog.info(title);
assertEquals("Some Diagnostic Report - final - 2 observations", title);
assertEquals("Some & Diagnostic Report - final - 2 observations", title);
// Now try it with the parser

View File

@ -394,7 +394,7 @@ public class ResfulServerMethodTest {
p = ourCtx.newXmlParser().setPrettyPrint(false);
enc = p.encodeResourceToString(bundle);
ourLog.info("Response:\n{}", enc);
assertThat(enc, StringContains.containsString("<searchParam><name value=\"quantityParam\"/><type value=\"quantity\"/></searchParam>"));
assertThat(enc, StringContains.containsString("<name value=\"quantityParam\"/><type value=\"quantity\"/>"));
}
// {
// IParser p = ourCtx.newJsonParser().setPrettyPrint(true);

View File

@ -13,4 +13,4 @@ practitioner.narrative=file:src/test/resources/narrative/Practitioner.html
# You may also override/define behaviour for datatypes
humanname.class=ca.uhn.fhir.model.dstu.composite.HumanNameDt
humanname.narrative=classpath:ca/uhn/fhir/narrative/HumanNameDt.html
humanname.narrative=classpath:ca/uhn/fhir/narrative/datatype/HumanNameDt.html

View File

@ -69,6 +69,7 @@ import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.rest.server.IBundleProvider;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.util.FhirTerser;
@ -759,6 +760,7 @@ public abstract class BaseFhirDao {
break;
}
} catch (UnsupportedEncodingException e) {
throw new InternalErrorException(e);
}
TagList tagList = (TagList) theResource.getResourceMetadata().get(ResourceMetadataKeyEnum.TAG_LIST);
@ -770,6 +772,9 @@ public abstract class BaseFhirDao {
}
String title = ResourceMetadataKeyEnum.TITLE.get(theResource);
if (title != null && title.length()>BaseHasResource.MAX_TITLE_LENGTH) {
title = title.substring(0, BaseHasResource.MAX_TITLE_LENGTH);
}
theEntity.setTitle(title);
}

View File

@ -17,7 +17,7 @@ import ca.uhn.fhir.model.primitive.InstantDt;
@MappedSuperclass
public abstract class BaseHasResource {
private static final int MAX_TITLE_LENGTH = 100;
public static final int MAX_TITLE_LENGTH = 100;
@Column(name = "RES_DELETED_AT", nullable = true)
@Temporal(TemporalType.TIMESTAMP)