Skip to content

Commit

Permalink
Merge pull request #2347 from opencb/TASK-5083
Browse files Browse the repository at this point in the history
TASK-5083 - Sample - Case junit test not working
  • Loading branch information
pfurio authored Oct 2, 2023
2 parents 554d79b + 2d6366b commit 8ba86bb
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.RandomStringUtils;
import org.bson.Document;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.internal.matchers.ThrowableMessageMatcher;
import org.opencb.biodata.models.clinical.Disorder;
import org.opencb.biodata.models.clinical.Phenotype;
import org.opencb.biodata.models.clinical.qc.SampleQcVariantStats;
Expand Down Expand Up @@ -2776,8 +2779,9 @@ public void deleteInUseInCATest() throws CatalogException {
try {
catalogManager.getSampleManager().delete(studyFqn, Collections.singletonList(case1.getProband().getSamples().get(0).getId()),
new QueryOptions(ParamConstants.FORCE, true), token);
fail("Expected CatalogException with message containing 'in use in 3 cases'");
} catch (CatalogException e) {
assertTrue(e.getMessage().contains("in use in 3 cases"));
MatcherAssert.assertThat(e, ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("in use in 3 cases")));
}

// unlock case3
Expand All @@ -2787,8 +2791,9 @@ public void deleteInUseInCATest() throws CatalogException {
try {
catalogManager.getSampleManager().delete(studyFqn, Collections.singletonList(case1.getProband().getSamples().get(0).getId()),
new QueryOptions(ParamConstants.FORCE, false), token);
fail("Expected CatalogException with message containing 'associated with individual'.");
} catch (CatalogException e) {
assertTrue(e.getMessage().contains("in use in 3 cases"));
MatcherAssert.assertThat(e, ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("associated with individual")));
}
}

Expand Down

0 comments on commit 8ba86bb

Please sign in to comment.