### Question:
NewTemplatePresenter implements WizardPage { public boolean isTemplateNameValid() { final String templateName = view.getTemplateName(); return templateName == null ? false : !templateName.trim().isEmpty(); } @Inject  NewTemplatePresenter(final View view,
                                final Caller<SpecManagementService> specManagementService,
                                final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView();  }### Answer:
@Test public void testIsTemplateNameValid() { when( view.getTemplateName() ) .thenReturn( null ) .thenReturn( "" ) .thenReturn( "test" ); assertFalse( presenter.isTemplateNameValid() ); assertFalse( presenter.isTemplateNameValid() ); assertTrue( presenter.isTemplateNameValid() ); }