Search in sources :

Example 1 with RelationshipImpl

use of org.ihtsdo.drools.unittest.domain.RelationshipImpl in project snomed-drools by IHTSDO.

the class RuleExecutorTest method testExecuteNullRelationshipId.

@Test(expected = BadRequestRuleExecutorException.class)
public void testExecuteNullRelationshipId() throws Exception {
    final Concept concept = new ConceptImpl("1").addDescription(new DescriptionImpl("2", "a  ")).addRelationship(new RelationshipImpl("r1", "3")).addRelationship(new RelationshipImpl(null, "4"));
    ruleExecutor.execute(RULE_SET_NAMES, Collections.singleton(concept), conceptService, descriptionService, relationshipService, true, false);
}
Also used : Concept(org.ihtsdo.drools.domain.Concept) ConceptImpl(org.ihtsdo.drools.unittest.domain.ConceptImpl) DescriptionImpl(org.ihtsdo.drools.unittest.domain.DescriptionImpl) RelationshipImpl(org.ihtsdo.drools.unittest.domain.RelationshipImpl) Test(org.junit.Test)

Example 2 with RelationshipImpl

use of org.ihtsdo.drools.unittest.domain.RelationshipImpl in project snomed-drools by IHTSDO.

the class RuleExecutorTest method testExecuteNullConceptId.

@Test(expected = BadRequestRuleExecutorException.class)
public void testExecuteNullConceptId() throws Exception {
    final Concept concept = new ConceptImpl(null).addDescription(new DescriptionImpl("2", "a  ")).addRelationship(new RelationshipImpl("r1", "3")).addRelationship(new RelationshipImpl("r2", "4"));
    ruleExecutor.execute(RULE_SET_NAMES, Collections.singleton(concept), conceptService, descriptionService, relationshipService, true, false);
}
Also used : Concept(org.ihtsdo.drools.domain.Concept) ConceptImpl(org.ihtsdo.drools.unittest.domain.ConceptImpl) DescriptionImpl(org.ihtsdo.drools.unittest.domain.DescriptionImpl) RelationshipImpl(org.ihtsdo.drools.unittest.domain.RelationshipImpl) Test(org.junit.Test)

Example 3 with RelationshipImpl

use of org.ihtsdo.drools.unittest.domain.RelationshipImpl in project snomed-drools by IHTSDO.

the class RuleExecutorTest method testExecuteNullDescriptionId.

@Test(expected = BadRequestRuleExecutorException.class)
public void testExecuteNullDescriptionId() throws Exception {
    final Concept concept = new ConceptImpl("1").addDescription(new DescriptionImpl(null, "a  ")).addRelationship(new RelationshipImpl("r1", "3")).addRelationship(new RelationshipImpl("r2", "4"));
    ruleExecutor.execute(RULE_SET_NAMES, Collections.singleton(concept), conceptService, descriptionService, relationshipService, true, false);
}
Also used : Concept(org.ihtsdo.drools.domain.Concept) ConceptImpl(org.ihtsdo.drools.unittest.domain.ConceptImpl) DescriptionImpl(org.ihtsdo.drools.unittest.domain.DescriptionImpl) RelationshipImpl(org.ihtsdo.drools.unittest.domain.RelationshipImpl) Test(org.junit.Test)

Example 4 with RelationshipImpl

use of org.ihtsdo.drools.unittest.domain.RelationshipImpl in project snomed-drools by IHTSDO.

the class RuleExecutorTest method testExecute.

@Test
public void testExecute() {
    final Concept concept = new ConceptImpl("1").addDescription(new DescriptionImpl("2", "a  ")).addRelationship(new RelationshipImpl("r1", "3")).addRelationship(new RelationshipImpl("r2", "4"));
    final List<InvalidContent> invalidContent = ruleExecutor.execute(RULE_SET_NAMES, Collections.singleton(concept), conceptService, descriptionService, relationshipService, true, false);
    Assert.assertEquals(1, invalidContent.size());
    final InvalidContent invalidContent1 = invalidContent.get(0);
    Assert.assertEquals(concept.getId(), invalidContent1.getConceptId());
    Assert.assertEquals("Term should not contain double spaces.", invalidContent1.getMessage());
    Assert.assertEquals("2", invalidContent1.getComponentId());
}
Also used : Concept(org.ihtsdo.drools.domain.Concept) ConceptImpl(org.ihtsdo.drools.unittest.domain.ConceptImpl) InvalidContent(org.ihtsdo.drools.response.InvalidContent) DescriptionImpl(org.ihtsdo.drools.unittest.domain.DescriptionImpl) RelationshipImpl(org.ihtsdo.drools.unittest.domain.RelationshipImpl) Test(org.junit.Test)

Example 5 with RelationshipImpl

use of org.ihtsdo.drools.unittest.domain.RelationshipImpl in project snomed-drools by IHTSDO.

the class RuleExecutorTest method testExecuteOnlyUnpublishedContent.

@Test
public void testExecuteOnlyUnpublishedContent() throws Exception {
    final Concept concept = new ConceptImpl("1").addDescription(new DescriptionImpl("2", "a  ").published()).addRelationship(new RelationshipImpl("r1", "3")).addRelationship(new RelationshipImpl("r2", "4"));
    final List<InvalidContent> invalidContent = ruleExecutor.execute(RULE_SET_NAMES, Collections.singleton(concept), conceptService, descriptionService, relationshipService, false, false);
    Assert.assertEquals(0, invalidContent.size());
}
Also used : Concept(org.ihtsdo.drools.domain.Concept) ConceptImpl(org.ihtsdo.drools.unittest.domain.ConceptImpl) InvalidContent(org.ihtsdo.drools.response.InvalidContent) DescriptionImpl(org.ihtsdo.drools.unittest.domain.DescriptionImpl) RelationshipImpl(org.ihtsdo.drools.unittest.domain.RelationshipImpl) Test(org.junit.Test)

Aggregations

Concept (org.ihtsdo.drools.domain.Concept)5 ConceptImpl (org.ihtsdo.drools.unittest.domain.ConceptImpl)5 DescriptionImpl (org.ihtsdo.drools.unittest.domain.DescriptionImpl)5 RelationshipImpl (org.ihtsdo.drools.unittest.domain.RelationshipImpl)5 Test (org.junit.Test)5 InvalidContent (org.ihtsdo.drools.response.InvalidContent)2