Search in sources :

Example 11 with Class

use of com.github.havardh.javaflow.ast.Class in project javaflow by havardh.

the class InheritanceTransformerTest method shouldLinkClassesWithParentOnMatchingName.

@Test
public void shouldLinkClassesWithParentOnMatchingName() {
    Class parent = ClassBuilder.classBuilder().withName("Parent").withPackageName("com.github.havardh.a").build();
    Class child = ClassBuilder.classBuilder().withName("Child").withParent(new Parent(CanonicalName.object("com.github.havardh.a", "Parent"))).build();
    transformer.transform(asList(parent, child));
    assertThat(child.getParent().get().getReference(), is(parent));
}
Also used : Parent(com.github.havardh.javaflow.ast.Parent) Class(com.github.havardh.javaflow.ast.Class) Test(org.junit.jupiter.api.Test)

Aggregations

Class (com.github.havardh.javaflow.ast.Class)11 Test (org.junit.jupiter.api.Test)10 AggregatedException (com.github.havardh.javaflow.exceptions.AggregatedException)5 Field (com.github.havardh.javaflow.ast.Field)2 Parent (com.github.havardh.javaflow.ast.Parent)2 Type (com.github.havardh.javaflow.ast.Type)2 MissingTypeException (com.github.havardh.javaflow.exceptions.MissingTypeException)2 Collections.singletonList (java.util.Collections.singletonList)2 List (java.util.List)2 CanonicalName (com.github.havardh.javaflow.model.CanonicalName)1 TypeMap (com.github.havardh.javaflow.model.TypeMap)1 Objects.isObject (com.github.havardh.javaflow.phases.writer.flow.converter.definitions.Objects.isObject)1 Primitives.isPrimitive (com.github.havardh.javaflow.phases.writer.flow.converter.definitions.Primitives.isPrimitive)1 Lists.concat (com.github.havardh.javaflow.util.Lists.concat)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors.toList (java.util.stream.Collectors.toList)1 Collectors.toSet (java.util.stream.Collectors.toSet)1