PeakInvestigatorDefaultProviderFactory implements PeakInvestigatorProviderFactory { @Override public PeakInvestigatorOptionsProvider createOptionsProvider(PiVersionsAction action, final int dataStart, final int dataEnd) { final String version = action.getLastUsedVersion().isEmpty() ? action.getCurrentVersion() : action.getLastUsedVersion(); return new PeakInvestigatorOptionsProvider() { @Override public Status show() { return Status.ACCEPT; } @Override public String getVersion() { return version; } @Override public int getStartMass() { return dataStart; } @Override public int getEndMass() { return dataEnd; } }; }  @Override PeakInvestigatorProjectProvider createProjectProvider(); @Override PeakInvestigatorOptionsProvider createOptionsProvider(PiVersionsAction action,
      final int dataStart, final int dataEnd); @Override PeakInvestigatorInitProvider createInitProvider(InitAction action);  }
@Test public void testVersionNoLastUsed() { PiVersionsAction action = mock(PiVersionsAction.class); when(action.getLastUsedVersion()).thenReturn(""); when(action.getCurrentVersion()).thenReturn("1.3"); PeakInvestigatorOptionsProvider provider = factory.createOptionsProvider(action, DATA_START, DATA_END); assertThat(provider.show(), equalTo(PeakInvestigatorProvider.Status.ACCEPT)); assertThat(provider.getVersion(), equalTo("1.3")); assertThat(provider.getStartMass(), equalTo(DATA_START)); assertThat(provider.getEndMass(), equalTo(DATA_END)); }
@Test public void testVersionWithLastUsed() { PiVersionsAction action = mock(PiVersionsAction.class); when(action.getLastUsedVersion()).thenReturn("1.3"); when(action.getCurrentVersion()).thenReturn("2.0"); PeakInvestigatorOptionsProvider provider = factory.createOptionsProvider(action, DATA_START, DATA_END); assertThat(provider.show(), equalTo(PeakInvestigatorProvider.Status.ACCEPT)); assertThat(provider.getVersion(), equalTo("1.3")); assertThat(provider.getStartMass(), equalTo(DATA_START)); assertThat(provider.getEndMass(), equalTo(DATA_END)); }