Search in sources :

Example 1 with StandaloneTraitFactory

use of org.drools.traits.core.util.StandaloneTraitFactory in project drools by kiegroup.

the class LegacyTraitTest method testTraitWithNonAccessorMethodShadowing.

@Test
public void testTraitWithNonAccessorMethodShadowing() {
    StandaloneTraitFactory factory = createStandaloneTraitFactory();
    try {
        SomeInterface r = (SomeInterface) factory.don(new SomeClass(), SomeInterface.class);
        r.prepare();
        assertEquals(42, r.getFoo());
        assertEquals("I did that", r.doThis("that"));
    } catch (LogicalTypeInconsistencyException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : LogicalTypeInconsistencyException(org.drools.traits.core.factmodel.LogicalTypeInconsistencyException) TraitTestUtils.createStandaloneTraitFactory(org.drools.traits.compiler.factmodel.traits.TraitTestUtils.createStandaloneTraitFactory) StandaloneTraitFactory(org.drools.traits.core.util.StandaloneTraitFactory) CommonTraitTest(org.drools.traits.compiler.CommonTraitTest) Test(org.junit.Test)

Aggregations

CommonTraitTest (org.drools.traits.compiler.CommonTraitTest)1 TraitTestUtils.createStandaloneTraitFactory (org.drools.traits.compiler.factmodel.traits.TraitTestUtils.createStandaloneTraitFactory)1 LogicalTypeInconsistencyException (org.drools.traits.core.factmodel.LogicalTypeInconsistencyException)1 StandaloneTraitFactory (org.drools.traits.core.util.StandaloneTraitFactory)1 Test (org.junit.Test)1