@Test
public void testThatCompositeReturnsASumOfViewManagers() {

  // Given
  CompositeReactPackage composite = new CompositeReactPackage(packageNo1, packageNo2);
  ViewManager managerNo1 = mock(ViewManager.class);
  when(managerNo1.getName()).thenReturn("ManagerNo1");
  // managerNo2 and managerNo3 will share same name, composite should return only the latter one
  final String sameModuleName = "SameModuleName";
  ViewManager managerNo2 = mock(ViewManager.class);
  when(managerNo2.getName()).thenReturn(sameModuleName);
  ViewManager managerNo3 = mock(ViewManager.class);
  when(managerNo3.getName()).thenReturn(sameModuleName);
  ViewManager managerNo4 = mock(ViewManager.class);
  when(managerNo4.getName()).thenReturn("ManagerNo4");
  when(packageNo1.createViewManagers(reactContext)).thenReturn(
      Arrays.asList(new ViewManager[]{managerNo1, managerNo2}));
  when(packageNo2.createViewManagers(reactContext)).thenReturn(
      Arrays.asList(new ViewManager[]{managerNo3, managerNo4}));
  // When
  List<ViewManager> compositeModules = composite.createViewManagers(reactContext);
  // Then
  // Wrapping lists into sets to be order-independent.
  // Note that there should be no managerNo2 returned.
  Set<ViewManager> expected = new HashSet<>(
      Arrays.asList(new ViewManager[]{managerNo1, managerNo3, managerNo4})
  );
  Set<ViewManager> actual = new HashSet<>(compositeModules);
  assertEquals(expected, actual);
}