### Question:
DefaultNewResourceHandler implements NewResourceHandler { @Override public void acceptContext(final Callback<Boolean, Void> callback) { callback.onSuccess(context != null && context.getActiveModule().isPresent()); } DefaultNewResourceHandler(final WorkspaceProjectContext context,
                              final Caller<KieModuleService> moduleService,
                              final Caller<ValidationService> validationService,
                              final PlaceManager placeManager,
                              final Event<NotificationEvent> notificationEvent,
                              final BusyIndicatorView busyIndicatorView);  DefaultNewResourceHandler(); @Override List<Pair<String, ? extends IsWidget>> getExtensions(); @Override void validate(final String baseFileName,
                         final ValidatorWithReasonCallback callback); @Override void acceptContext(final Callback<Boolean, Void> callback); @Override Command getCommand(final NewResourcePresenter newResourcePresenter); @Override boolean canCreate();  }### Answer:
@Test public void testAcceptContextWithContextWithNoProject() { final Callback<Boolean, Void> callback = mock(Callback.class); when(context.getActiveModule()).thenReturn(Optional.empty()); handler.acceptContext(callback); verify(callback, times(1)).onSuccess(false); }
@Test public void testAcceptContextWithContextWithProject() { final Callback<Boolean, Void> callback = mock(Callback.class); when(context.getActiveModule()).thenReturn(Optional.of(mock(Module.class))); handler.acceptContext(callback); verify(callback, times(1)).onSuccess(true); }