Search in sources :

Example 1 with MatryoshkaDoll

use of org.drools.workbench.models.testscenarios.backend.MatryoshkaDoll in project drools by kiegroup.

the class FactAssignmentFieldPopulatorTest method testMatryoshkaDollSituation.

@Test
public void testMatryoshkaDollSituation() throws Exception {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    TypeResolver typeResolver = new ClassTypeResolver(new HashSet<String>(), classLoader);
    typeResolver.addImport("org.drools.workbench.models.testscenarios.backend.MatryoshkaDoll");
    MatryoshkaDoll matryoshkaDoll = new MatryoshkaDoll();
    FactAssignmentField factAssignmentField = createFactAssignmentField();
    addFactAssignmentFieldIntoFactAssignmentField(factAssignmentField, 5);
    FactAssignmentFieldPopulator factAssignmentFieldPopulator = new FactAssignmentFieldPopulator(matryoshkaDoll, factAssignmentField, typeResolver);
    factAssignmentFieldPopulator.populate(new HashMap<String, Object>());
    assertNotNull(matryoshkaDoll.getMatryoshkaDoll());
    assertNotNull(matryoshkaDoll.getMatryoshkaDoll().getMatryoshkaDoll());
    assertNotNull(matryoshkaDoll.getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll());
    assertNotNull(matryoshkaDoll.getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll());
    assertNotNull(matryoshkaDoll.getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll());
    assertNotNull(matryoshkaDoll.getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll());
    assertNull(matryoshkaDoll.getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll().getMatryoshkaDoll());
}
Also used : ClassTypeResolver(org.kie.soup.project.datamodel.commons.types.ClassTypeResolver) TypeResolver(org.kie.soup.project.datamodel.commons.types.TypeResolver) ClassTypeResolver(org.kie.soup.project.datamodel.commons.types.ClassTypeResolver) MatryoshkaDoll(org.drools.workbench.models.testscenarios.backend.MatryoshkaDoll) FactAssignmentField(org.drools.workbench.models.testscenarios.shared.FactAssignmentField) Test(org.junit.Test)

Aggregations

MatryoshkaDoll (org.drools.workbench.models.testscenarios.backend.MatryoshkaDoll)1 FactAssignmentField (org.drools.workbench.models.testscenarios.shared.FactAssignmentField)1 Test (org.junit.Test)1 ClassTypeResolver (org.kie.soup.project.datamodel.commons.types.ClassTypeResolver)1 TypeResolver (org.kie.soup.project.datamodel.commons.types.TypeResolver)1