### Question:
FunctionDefinition extends Expression implements HasExpression { @Override public List<HasTypeRef> getHasTypeRefs() { final List<HasTypeRef> hasTypeRefs = super.getHasTypeRefs(); hasTypeRefs.addAll(getNotNullHasTypeRefs(getExpression())); hasTypeRefs.addAll(getFlatHasTypeRefs(getFormalParameter())); return hasTypeRefs; } FunctionDefinition();  FunctionDefinition(final Id id,
                              final Description description,
                              final QName typeRef,
                              final Expression expression); @Override FunctionDefinition copy(); @Override Expression getExpression(); @Override void setExpression(final Expression expression); @Override DMNModelInstrumentedBase asDMNModelInstrumentedBase(); List<InformationItem> getFormalParameter(); Kind getKind(); void setKind(Kind kind); @Override List<HasTypeRef> getHasTypeRefs(); @Override int getRequiredComponentWidthCount(); @Override boolean equals(final Object o); @Override int hashCode();  }### Answer:
@Test public void testGetHasTypeRefs() { final Expression expression = mock(Expression.class); final InformationItem informationItem1 = mock(InformationItem.class); final InformationItem informationItem2 = mock(InformationItem.class); final List<InformationItem> formalParameter = asList(informationItem1, informationItem2); final HasTypeRef hasTypeRef1 = mock(HasTypeRef.class); final HasTypeRef hasTypeRef2 = mock(HasTypeRef.class); final HasTypeRef hasTypeRef3 = mock(HasTypeRef.class); final HasTypeRef hasTypeRef4 = mock(HasTypeRef.class); doReturn(expression).when(functionDefinition).getExpression(); doReturn(formalParameter).when(functionDefinition).getFormalParameter(); when(expression.getHasTypeRefs()).thenReturn(asList(hasTypeRef1, hasTypeRef2)); when(informationItem1.getHasTypeRefs()).thenReturn(asList(hasTypeRef3)); when(informationItem2.getHasTypeRefs()).thenReturn(asList(hasTypeRef4)); final List<HasTypeRef> actualHasTypeRefs = functionDefinition.getHasTypeRefs(); final List<HasTypeRef> expectedHasTypeRefs = asList(functionDefinition, hasTypeRef1, hasTypeRef2, hasTypeRef3, hasTypeRef4); assertEquals(expectedHasTypeRefs, actualHasTypeRefs); }