@Test public void testCompositeItemDefinition() { final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("0008-LX-arithmetic.dmn", this.getClass() ); final DMNModel dmnModel = runtime.getModel("https://github.com/kiegroup/kie-dmn", "0008-LX-arithmetic" ); assertThat( dmnModel, notNullValue() ); final ItemDefNode itemDef = dmnModel.getItemDefinitionByName("tLoan" ); assertThat( itemDef.getName(), is( "tLoan" ) ); assertThat( itemDef.getId(), is( "tLoan" ) ); final DMNType type = itemDef.getType(); assertThat( type, is( notNullValue() ) ); assertThat( type.getName(), is( "tLoan" ) ); assertThat( type.getId(), is( "tLoan" ) ); assertThat( type, is( instanceOf( CompositeTypeImpl.class ) ) ); final CompositeTypeImpl compType = (CompositeTypeImpl) type; assertThat( compType.getFields().size(), is( 3 ) ); final DMNType principal = compType.getFields().get("principal" ); assertThat( principal, is( notNullValue() ) ); assertThat( principal.getName(), is( "number" ) ); assertThat( ((SimpleTypeImpl)principal).getFeelType(), is( BuiltInType.NUMBER ) ); final DMNType rate = compType.getFields().get("rate" ); assertThat( rate, is( notNullValue() ) ); assertThat( rate.getName(), is( "number" ) ); assertThat( ((SimpleTypeImpl)rate).getFeelType(), is( BuiltInType.NUMBER ) ); final DMNType termMonths = compType.getFields().get("termMonths" ); assertThat( termMonths, is( notNullValue() ) ); assertThat( termMonths.getName(), is( "number" ) ); assertThat( ((SimpleTypeImpl)termMonths).getFeelType(), is( BuiltInType.NUMBER ) ); }
final DMNType dmnPerson = typeRegistry.registerType(new CompositeTypeImpl(testNS, "person", null, false, personPrototype, null, null)); final DMNType dmnPersonList = typeRegistry.registerType(new CompositeTypeImpl(testNS, "personList", null, true, null, dmnPerson, null)); final DMNType dmnListOfPersonsGrouped = typeRegistry.registerType(new CompositeTypeImpl(testNS, "groups", null, true, null, dmnPersonList, null)); final DMNType listOfGroups = typeRegistry.registerType(new CompositeTypeImpl(testNS, "listOfGroups", null, true, null, dmnListOfPersonsGrouped, null)); final List<Object> groupsContainingBobPartitionedBySize = Arrays.asList(the2ListsThatContainBob, Collections.singletonList(bobANDjohn));