@Test
public void testCustomDirectEvents() {

  ViewManager mockViewManager = mock(ViewManager.class);
  List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
  when(mockViewManager.getExportedCustomDirectEventTypeConstants())
      .thenReturn(MapBuilder.of("onTwirl", TWIRL_DIRECT_EVENT_MAP));
  UIManagerModule uiManagerModule =
      new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
  Map<String, Object> constants = uiManagerModule.getConstants();
  assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES))
      .contains(MapEntry.entry("onTwirl", TWIRL_DIRECT_EVENT_MAP))
      .containsKey("topLoadingStart");
}