private void addComponents(int components, List<AbstractComponent> childList, List<AbstractComponent> createdComponents) {
for (int i = 0; i < components; i++) {
AbstractComponent ac = Mockito.mock(AbstractComponent.class);
Mockito.when(ac.getComponents()).thenReturn(Collections.<AbstractComponent>emptyList());
Mockito.when(ac.isLeaf()).thenReturn(true);
final View mvm = Mockito.mock(View.class);
ViewInfo vi = new ViewInfo(TableViewManifestation.class, "", ViewType.EMBEDDED) {
@Override
public View createView(AbstractComponent component) {
return mvm;
}
};
Mockito.when(ac.getViewInfos(ViewType.NODE)).thenReturn(Collections.singleton(vi));
Mockito.when(ac.getViewInfos(ViewType.EMBEDDED)).thenReturn(Collections.singleton(vi));
Mockito.when(ac.getComponentTypeID()).thenReturn("MockComponent");
Mockito.when(mvm.getManifestedComponent()).thenReturn(ac);
Mockito.when(mvm.getInfo()).thenReturn(vi);
childList.add(ac);
createdComponents.add(ac);
}
}