NewGuidedDecisionTableGraphHandler extends DefaultNewResourceHandler { @Override public void create( final Package pkg, final String baseFileName, final NewResourcePresenter presenter ) { busyIndicatorView.showBusyIndicator( CommonConstants.INSTANCE.Saving() ); graphService.call( getSuccessCallback( presenter ), new HasBusyIndicatorDefaultErrorCallback( busyIndicatorView ) ).create( pkg.getPackageMainResourcesPath(), buildFileName( baseFileName, resourceType ), new GuidedDecisionTableEditorGraphModel(), "" ); } NewGuidedDecisionTableGraphHandler(); @Inject  NewGuidedDecisionTableGraphHandler( final PlaceManager placeManager,
                                               final Caller<GuidedDecisionTableGraphEditorService> graphService,
                                               final GuidedDTableGraphResourceType resourceType,
                                               final BusyIndicatorView busyIndicatorView ); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override void create( final Package pkg,
                        final String baseFileName,
                        final NewResourcePresenter presenter );  }
@Test public void testCreate() { final String fileName = "fileName"; final Package pkg = mock( Package.class ); final Path resourcesPath = PathFactory.newPath( "resources", "default: when( pkg.getPackageMainResourcesPath() ).thenReturn( resourcesPath ); handler.create( pkg, fileName, newResourcePresenter ); verify( busyIndicatorView, times( 1 ) ).hideBusyIndicator(); verify( newResourcePresenter, times( 1 ) ).complete(); verify( mockNotificationEvent, times( 1 ) ).fire( any( NotificationEvent.class ) ); verify( newResourceSuccessEventMock, times( 1 ) ).fire( any( NewResourceSuccessEvent.class ) ); verify( placeManager, times( 1 ) ).goTo( pathCaptor.capture() ); assertEquals( "default: pathCaptor.getValue().toURI() ); verify( service, times( 1 ) ).create( eq( resourcesPath ), eq( fileName + "." + resourceType.getSuffix() ), any( GuidedDecisionTableEditorGraphModel.class ), any( String.class ) ); }