#77 - Fixed wildcard string compare that was breaking inclusion

This commit is contained in:
b.debeaubien 2015-03-12 10:32:22 -04:00
parent 7f9b1baa14
commit bac290bc89
2 changed files with 23 additions and 2 deletions

View File

@ -1,5 +1,26 @@
package ca.uhn.fhir.util;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
@ -40,7 +61,7 @@ public class ResourceReferenceInfo {
}
public boolean matchesInclude(Include theInclude) {
if (theInclude.getValue() == "*")
if (theInclude.getValue().equals("*"))
return true;
return (theInclude.getValue().equals(myOwningResource + "." + myName));
}

View File

@ -74,7 +74,7 @@ public class Dstu2BundleFactoryTest {
@Test
public void whenIncludeIsAsterisk_bundle_shouldContainAllReferencedResources() throws Exception {
Bundle bundle = makeBundle(BundleInclusionRule.BASED_ON_INCLUDES, includes("*"));
Bundle bundle = makeBundle(BundleInclusionRule.BASED_ON_INCLUDES, includes(new String("*")));
assertEquals(6, bundle.getEntry().size());
assertEquals(2, numberOfEntriesOfType(bundle, Specimen.class));