PeakInvestigatorDefaultProviderFactory implements PeakInvestigatorProviderFactory { @Override public PeakInvestigatorProjectProvider createProjectProvider() { return new PeakInvestigatorProjectProvider() { @Override public Status show() { if (System.getProperty("peakinvestigator.username") == null || System.getProperty("peakinvestigator.password") == null || System.getProperty("peakinvestigator.project") == null) { return Status.CANCEL; } return Status.ACCEPT; } @Override public String getUsername() { return System.getProperty("peakinvestigator.username"); } @Override public String getPassword() { return System.getProperty("peakinvestigator.password"); } @Override public int getProjectId() { return Integer.parseInt(System.getProperty("peakinvestigator.project")); } }; }  @Override PeakInvestigatorProjectProvider createProjectProvider(); @Override PeakInvestigatorOptionsProvider createOptionsProvider(PiVersionsAction action,
      final int dataStart, final int dataEnd); @Override PeakInvestigatorInitProvider createInitProvider(InitAction action);  }
@Test public void testProjectInfoMissing() { PeakInvestigatorProjectProvider provider = factory.createProjectProvider(); assertThat(provider.show(), equalTo(PeakInvestigatorProvider.Status.CANCEL)); }
@Test public void testProjectInfoAvailable() { System.setProperty("peakinvestigator.username", "joe"); System.setProperty("peakinvestigator.password", "badpassword"); System.setProperty("peakinvestigator.project", "1234"); PeakInvestigatorProjectProvider provider = factory.createProjectProvider(); assertThat(provider.show(), equalTo(PeakInvestigatorProvider.Status.ACCEPT)); assertThat(provider.getUsername(), equalTo("joe")); assertThat(provider.getPassword(), equalTo("badpassword")); assertThat(provider.getProjectId(), equalTo(1234)); }