From 555cd63c7e7746747ef7993257585c6b37f841d3 Mon Sep 17 00:00:00 2001
From: Robert Applin <40830825+robertapplin@users.noreply.github.com>
Date: Mon, 21 Jan 2019 16:26:01 +0000
Subject: [PATCH] Refs #24534. Start unit tests for the model

---
 .../IndirectFitDataCreationHelper.h           |  15 +-
 .../src/IndirectFitDataCreationHelper.cpp     |  33 +-
 .../IndirectFitOutputOptionsModel.cpp         |  13 +-
 .../Indirect/IndirectFitOutputOptionsModel.h  |   2 +
 .../Indirect/test/CMakeLists.txt              |   1 +
 .../Indirect/test/IndirectFitDataTest.h       |   6 +
 .../test/IndirectFitOutputOptionsModelTest.h  | 282 ++++++++++++++++++
 .../Indirect/test/IndirectFitOutputTest.h     |   6 +
 .../Indirect/test/IndirectFitPlotModelTest.h  |   6 +
 .../test/IndirectFitPlotPresenterTest.h       |   3 +-
 .../Indirect/test/IndirectFittingModelTest.h  |  11 +-
 11 files changed, 363 insertions(+), 15 deletions(-)
 create mode 100644 qt/scientific_interfaces/Indirect/test/IndirectFitOutputOptionsModelTest.h

diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/IndirectFitDataCreationHelper.h b/Framework/TestHelpers/inc/MantidTestHelpers/IndirectFitDataCreationHelper.h
index 581c1f7f3d1..de4f8c761d3 100644
--- a/Framework/TestHelpers/inc/MantidTestHelpers/IndirectFitDataCreationHelper.h
+++ b/Framework/TestHelpers/inc/MantidTestHelpers/IndirectFitDataCreationHelper.h
@@ -10,6 +10,7 @@
 #include "MantidAPI/AnalysisDataService.h"
 #include "MantidAPI/MatrixWorkspace_fwd.h"
 #include "MantidAPI/TextAxis.h"
+#include "MantidAPI/WorkspaceGroup.h"
 #include "MantidHistogramData/BinEdges.h"
 
 #include <string>
@@ -26,12 +27,22 @@ int const END_X_COLUMN(3);
 int const EXCLUDE_REGION_COLUMN(4);
 
 /// Functions used in the creation of workspaces
-Mantid::API::MatrixWorkspace_sptr createWorkspace(int const &numberOfSpectra);
+Mantid::API::MatrixWorkspace_sptr createWorkspace(int const &numberOfSpectra,
+                                                  int const &numberOfBins = 10);
 Mantid::API::MatrixWorkspace_sptr createInstrumentWorkspace(int const &xLength,
                                                             int const &yLength);
 Mantid::API::MatrixWorkspace_sptr
 createWorkspaceWithTextAxis(int const &numberOfSpectra,
-                            std::vector<std::string> const &labels);
+                            std::vector<std::string> const &labels,
+                            int const &numberOfBins = 10);
+Mantid::API::WorkspaceGroup_sptr
+createGroupWorkspace(std::size_t const &numberOfWorkspaces,
+                     int const &numberOfSpectra, int const &numberOfBins = 10);
+Mantid::API::WorkspaceGroup_sptr
+createGroupWorkspaceWithTextAxes(std::size_t const &numberOfWorkspaces,
+                                 std::vector<std::string> const &labels,
+                                 int const &numberOfSpectra,
+                                 int const &numberOfBins = 10);
 
 Mantid::API::TextAxis *getTextAxis(int const &numberOfSpectra,
                                    std::vector<std::string> const &labels);
diff --git a/Framework/TestHelpers/src/IndirectFitDataCreationHelper.cpp b/Framework/TestHelpers/src/IndirectFitDataCreationHelper.cpp
index 3aab288df16..42f07d00168 100644
--- a/Framework/TestHelpers/src/IndirectFitDataCreationHelper.cpp
+++ b/Framework/TestHelpers/src/IndirectFitDataCreationHelper.cpp
@@ -5,8 +5,10 @@ namespace Mantid {
 namespace IndirectFitDataCreationHelper {
 using namespace Mantid::API;
 
-MatrixWorkspace_sptr createWorkspace(int const &numberOfSpectra) {
-  return WorkspaceCreationHelper::create2DWorkspace(numberOfSpectra, 10);
+MatrixWorkspace_sptr createWorkspace(int const &numberOfSpectra,
+                                     int const &numberOfBins) {
+  return WorkspaceCreationHelper::create2DWorkspace(numberOfSpectra,
+                                                    numberOfBins);
 }
 
 MatrixWorkspace_sptr createInstrumentWorkspace(int const &xLength,
@@ -17,9 +19,10 @@ MatrixWorkspace_sptr createInstrumentWorkspace(int const &xLength,
 
 MatrixWorkspace_sptr
 createWorkspaceWithTextAxis(int const &numberOfSpectra,
-                            std::vector<std::string> const &labels) {
+                            std::vector<std::string> const &labels,
+                            int const &numberOfBins) {
   if (static_cast<std::size_t>(numberOfSpectra) == labels.size()) {
-    auto workspace = createWorkspace(numberOfSpectra);
+    auto workspace = createWorkspace(numberOfSpectra, numberOfBins);
     workspace->replaceAxis(1, getTextAxis(numberOfSpectra, labels));
     return workspace;
   } else
@@ -27,6 +30,28 @@ createWorkspaceWithTextAxis(int const &numberOfSpectra,
         "The number of spectra is not equal to the number of labels");
 }
 
+WorkspaceGroup_sptr createGroupWorkspace(std::size_t const &numberOfWorkspaces,
+                                         int const &numberOfSpectra,
+                                         int const &numberOfBins) {
+  auto groupWorkspace = boost::make_shared<WorkspaceGroup>();
+  for (auto i = 0u; i < numberOfWorkspaces; ++i)
+    groupWorkspace->addWorkspace(
+        createWorkspace(numberOfSpectra, numberOfBins));
+  return groupWorkspace;
+}
+
+WorkspaceGroup_sptr
+createGroupWorkspaceWithTextAxes(std::size_t const &numberOfWorkspaces,
+                                 std::vector<std::string> const &labels,
+                                 int const &numberOfSpectra,
+                                 int const &numberOfBins) {
+  auto groupWorkspace = boost::make_shared<WorkspaceGroup>();
+  for (auto i = 0u; i < numberOfWorkspaces; ++i)
+    groupWorkspace->addWorkspace(
+        createWorkspaceWithTextAxis(numberOfSpectra, labels, numberOfBins));
+  return groupWorkspace;
+}
+
 TextAxis *getTextAxis(int const &numberOfSpectra,
                       std::vector<std::string> const &labels) {
   auto axis = new TextAxis(numberOfSpectra);
diff --git a/qt/scientific_interfaces/Indirect/IndirectFitOutputOptionsModel.cpp b/qt/scientific_interfaces/Indirect/IndirectFitOutputOptionsModel.cpp
index f29767aba21..dba40f40e17 100644
--- a/qt/scientific_interfaces/Indirect/IndirectFitOutputOptionsModel.cpp
+++ b/qt/scientific_interfaces/Indirect/IndirectFitOutputOptionsModel.cpp
@@ -16,8 +16,7 @@ using namespace Mantid::API;
 namespace {
 
 std::string noWorkspaceErrorMessage(std::string const &process) {
-  return "The " + process +
-         " of the result workspace failed:\n\n No workspace found";
+  return "The " + process + " of a workspace failed:\n\n No workspace found";
 }
 
 MatrixWorkspace_const_sptr convertToMatrixWorkspace(Workspace_sptr workspace) {
@@ -96,7 +95,7 @@ namespace CustomInterfaces {
 namespace IDA {
 
 IndirectFitOutputOptionsModel::IndirectFitOutputOptionsModel()
-    : m_resultGroup(), m_spectraToPlot() {}
+    : m_resultGroup(), m_pdfGroup(), m_spectraToPlot() {}
 
 void IndirectFitOutputOptionsModel::setResultWorkspace(
     WorkspaceGroup_sptr groupWorkspace) {
@@ -108,6 +107,14 @@ void IndirectFitOutputOptionsModel::setPDFWorkspace(
   m_pdfGroup = groupWorkspace;
 }
 
+WorkspaceGroup_sptr IndirectFitOutputOptionsModel::getResultWorkspace() const {
+  return m_resultGroup;
+}
+
+WorkspaceGroup_sptr IndirectFitOutputOptionsModel::getPDFWorkspace() const {
+  return m_pdfGroup;
+}
+
 void IndirectFitOutputOptionsModel::removePDFWorkspace() { m_pdfGroup.reset(); }
 
 bool IndirectFitOutputOptionsModel::isResultGroupPlottable() const {
diff --git a/qt/scientific_interfaces/Indirect/IndirectFitOutputOptionsModel.h b/qt/scientific_interfaces/Indirect/IndirectFitOutputOptionsModel.h
index 65efd194912..ff2be0d80df 100644
--- a/qt/scientific_interfaces/Indirect/IndirectFitOutputOptionsModel.h
+++ b/qt/scientific_interfaces/Indirect/IndirectFitOutputOptionsModel.h
@@ -27,6 +27,8 @@ public:
 
   void setResultWorkspace(Mantid::API::WorkspaceGroup_sptr groupWorkspace);
   void setPDFWorkspace(Mantid::API::WorkspaceGroup_sptr groupWorkspace);
+  Mantid::API::WorkspaceGroup_sptr getResultWorkspace() const;
+  Mantid::API::WorkspaceGroup_sptr getPDFWorkspace() const;
 
   void removePDFWorkspace();
 
diff --git a/qt/scientific_interfaces/Indirect/test/CMakeLists.txt b/qt/scientific_interfaces/Indirect/test/CMakeLists.txt
index d7e32222b1c..05835d48794 100644
--- a/qt/scientific_interfaces/Indirect/test/CMakeLists.txt
+++ b/qt/scientific_interfaces/Indirect/test/CMakeLists.txt
@@ -6,6 +6,7 @@ set ( TEST_FILES
   IndirectDataTablePresenterTest.h
   IndirectFitDataPresenterTest.h
   IndirectFitDataTest.h
+  IndirectFitOutputOptionsModelTest.h
   IndirectFitOutputTest.h
   IndirectFitPlotModelTest.h
   IndirectFitPlotPresenterTest.h
diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h
index 68348bf5035..71824bdd189 100644
--- a/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h
+++ b/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h
@@ -1,3 +1,9 @@
+// Mantid Repository : https://github.com/mantidproject/mantid
+//
+// Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI,
+//     NScD Oak Ridge National Laboratory, European Spallation Source
+//     & Institut Laue - Langevin
+// SPDX - License - Identifier: GPL - 3.0 +
 #ifndef MANTID_INDIRECTFITDATATEST_H_
 #define MANTID_INDIRECTFITDATATEST_H_
 
diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFitOutputOptionsModelTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFitOutputOptionsModelTest.h
new file mode 100644
index 00000000000..69bfa08d422
--- /dev/null
+++ b/qt/scientific_interfaces/Indirect/test/IndirectFitOutputOptionsModelTest.h
@@ -0,0 +1,282 @@
+// Mantid Repository : https://github.com/mantidproject/mantid
+//
+// Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI,
+//     NScD Oak Ridge National Laboratory, European Spallation Source
+//     & Institut Laue - Langevin
+// SPDX - License - Identifier: GPL - 3.0 +
+#ifndef MANTIDQT_INDIRECTFITOPTIONSMODELTEST_H_
+#define MANTIDQT_INDIRECTFITOPTIONSMODELTEST_H_
+
+#include <cxxtest/TestSuite.h>
+
+#include "IndirectFitOutputOptionsModel.h"
+#include "MantidAPI/FrameworkManager.h"
+#include "MantidTestHelpers/IndirectFitDataCreationHelper.h"
+
+using namespace Mantid::API;
+using namespace Mantid::IndirectFitDataCreationHelper;
+using namespace MantidQt::CustomInterfaces::IDA;
+
+namespace {
+
+/// Note that the number of labels must be equal to the numberOfSpectra given to
+/// a workspace
+std::vector<std::string> getThreeAxisLabels() {
+  return {"Amplitude", "HWHM", "PeakCentre"};
+}
+
+std::vector<SpectrumToPlot>
+getExpectedAllSpectra(std::size_t const &numberOfWorkspaces,
+                      std::size_t const &numberOfSpectra,
+                      std::string const &workspaceName = "") {
+  std::vector<SpectrumToPlot> spectraToPlot;
+  for (auto i = 0u; i < numberOfWorkspaces; ++i)
+    for (auto j = 0u; j < numberOfSpectra; ++j)
+      spectraToPlot.emplace_back(std::make_pair(workspaceName, j));
+  return spectraToPlot;
+}
+
+std::vector<SpectrumToPlot>
+getExpectedParameterSpectra(std::size_t const &numberOfWorkspaces,
+                            std::size_t const &index,
+                            std::string const &workspaceName = "") {
+  std::vector<SpectrumToPlot> spectraToPlot;
+  for (auto i = 0u; i < numberOfWorkspaces; ++i)
+    spectraToPlot.emplace_back(std::make_pair(workspaceName, index));
+  return spectraToPlot;
+}
+
+} // namespace
+
+class IndirectFitOutputOptionsModelTest : public CxxTest::TestSuite {
+public:
+  /// WorkflowAlgorithms do not appear in the FrameworkManager without this line
+  IndirectFitOutputOptionsModelTest() { FrameworkManager::Instance(); }
+
+  static IndirectFitOutputOptionsModelTest *createSuite() {
+    return new IndirectFitOutputOptionsModelTest();
+  }
+
+  static void destroySuite(IndirectFitOutputOptionsModelTest *suite) {
+    delete suite;
+  }
+
+  void setUp() override {
+    m_model = std::make_unique<IndirectFitOutputOptionsModel>();
+  }
+
+  void tearDown() override { m_model.reset(); }
+
+  void
+  test_that_the_model_is_instantiated_without_stored_workspaces_or_spectraToPlot() {
+    TS_ASSERT(!m_model->getResultWorkspace());
+    TS_ASSERT(!m_model->getPDFWorkspace());
+    TS_ASSERT(m_model->getSpectraToPlot().empty());
+  }
+
+  void test_that_setResultWorkspace_will_set_the_stored_result_group() {
+    auto const resultGroup = createGroupWorkspace(2, 3);
+
+    m_model->setResultWorkspace(resultGroup);
+
+    TS_ASSERT_EQUALS(m_model->getResultWorkspace(), resultGroup);
+  }
+
+  void test_that_setPDFWorkspace_will_set_the_stored_PDF_group() {
+    auto const pdfGroup = createGroupWorkspace(2, 3);
+
+    m_model->setPDFWorkspace(pdfGroup);
+
+    TS_ASSERT_EQUALS(m_model->getPDFWorkspace(), pdfGroup);
+  }
+
+  void test_that_removePDFWorkspace_will_remove_the_stored_PDF_workspace() {
+    auto const pdfGroup = createGroupWorkspace(2, 3);
+
+    m_model->setPDFWorkspace(pdfGroup);
+    m_model->removePDFWorkspace();
+
+    TS_ASSERT(!m_model->getPDFWorkspace());
+  }
+
+  void
+  test_that_isResultGroupPlottable_returns_true_if_it_contains_a_workspace_with_more_than_one_data_point() {
+    auto const resultGroup = createGroupWorkspace(2, 3, 10);
+
+    m_model->setResultWorkspace(resultGroup);
+
+    TS_ASSERT(m_model->isResultGroupPlottable());
+  }
+
+  void
+  test_that_isResultGroupPlottable_returns_false_if_it_does_not_contain_a_workspace_with_more_than_one_data_point() {
+    auto const resultGroup = createGroupWorkspace(2, 3, 1);
+
+    m_model->setResultWorkspace(resultGroup);
+
+    TS_ASSERT(!m_model->isResultGroupPlottable());
+  }
+
+  void
+  test_that_isPDFGroupPlottable_returns_true_if_it_contains_a_workspace_with_more_than_one_data_point() {
+    auto const pdfGroup = createGroupWorkspace(2, 3, 10);
+
+    m_model->setPDFWorkspace(pdfGroup);
+
+    TS_ASSERT(m_model->isPDFGroupPlottable());
+  }
+
+  void
+  test_that_isPDFGroupPlottable_returns_false_if_it_does_not_contain_a_workspace_with_more_than_one_data_point() {
+    auto const pdfGroup = createGroupWorkspace(2, 3, 1);
+
+    m_model->setPDFWorkspace(pdfGroup);
+
+    TS_ASSERT(!m_model->isPDFGroupPlottable());
+  }
+
+  void test_that_clearSpectraToPlot_will_remove_the_stored_spectraToPlot() {
+    auto const resultGroup =
+        createGroupWorkspaceWithTextAxes(2, getThreeAxisLabels(), 3);
+
+    m_model->setResultWorkspace(resultGroup);
+    m_model->plotResult("Amplitude");
+    m_model->clearSpectraToPlot();
+
+    TS_ASSERT(m_model->getSpectraToPlot().empty());
+  }
+
+  void
+  test_that_getSpectraToPlot_will_return_an_empty_vector_if_none_of_the_workspaces_are_plottable() {
+    auto const resultGroup =
+        createGroupWorkspaceWithTextAxes(2, getThreeAxisLabels(), 3, 1);
+
+    m_model->setResultWorkspace(resultGroup);
+    m_model->plotResult("Amplitude");
+
+    TS_ASSERT(m_model->getSpectraToPlot().empty());
+  }
+
+  void
+  test_that_getSpectraToPlot_will_return_an_empty_vector_if_the_parameter_passed_does_not_exist() {
+    auto const resultGroup =
+        createGroupWorkspaceWithTextAxes(2, getThreeAxisLabels(), 3);
+
+    m_model->setResultWorkspace(resultGroup);
+    m_model->plotResult("Not a parameter");
+
+    TS_ASSERT(m_model->getSpectraToPlot().empty());
+  }
+
+  void
+  test_that_getSpectraToPlot_will_return_a_vector_with_the_correct_number_of_spectra_information_when_plotting_all() {
+    auto const resultGroup =
+        createGroupWorkspaceWithTextAxes(2, getThreeAxisLabels(), 3);
+
+    m_model->setResultWorkspace(resultGroup);
+    m_model->plotResult("All");
+
+    /// Here the size should be equal to numberOfWorkspaces * numberOfSpectra as
+    /// it plots all the spectra in each of the workspaces
+    TS_ASSERT_EQUALS(m_model->getSpectraToPlot().size(), 6)
+  }
+
+  void
+  test_that_getSpectraToPlot_will_return_a_vector_with_the_correct_number_of_spectra_information_when_plotting_a_parameter() {
+    auto const resultGroup =
+        createGroupWorkspaceWithTextAxes(2, getThreeAxisLabels(), 3);
+
+    m_model->setResultWorkspace(resultGroup);
+    m_model->plotResult("Amplitude");
+
+    /// Here the size should be equal to the numberOfWorkspaces as it will be
+    /// plotting one spectra from each workspace
+    TS_ASSERT_EQUALS(m_model->getSpectraToPlot().size(), 2)
+  }
+
+  void
+  test_that_getSpectraToPlot_will_return_a_vector_containing_the_correct_spectra_indices_when_plotting_all() {
+    auto const resultGroup =
+        createGroupWorkspaceWithTextAxes(2, getThreeAxisLabels(), 3);
+
+    m_model->setResultWorkspace(resultGroup);
+    m_model->plotResult("All");
+
+    TS_ASSERT_EQUALS(m_model->getSpectraToPlot(), getExpectedAllSpectra(2, 3))
+  }
+
+  void
+  test_that_getSpectraToPlot_will_return_a_vector_containing_the_correct_spectra_indices_when_plotting_a_parameter() {
+    auto const resultGroup =
+        createGroupWorkspaceWithTextAxes(2, getThreeAxisLabels(), 3);
+
+    m_model->setResultWorkspace(resultGroup);
+    m_model->plotResult("HWHM"); /// This parameter has a workspace index of 1
+
+    TS_ASSERT_EQUALS(m_model->getSpectraToPlot(),
+                     getExpectedParameterSpectra(2, 1))
+  }
+
+  void test_that_plotResult_will_throw_when_there_is_no_result_workspace_set() {
+    TS_ASSERT_THROWS(m_model->plotResult("HWHM"), std::runtime_error);
+  }
+
+  void test_that_plotPDF_will_throw_when_there_is_no_pdf_workspace_set() {
+    TS_ASSERT_THROWS(m_model->plotPDF("WorkspaceName", "HWHM"),
+                     std::runtime_error);
+  }
+
+  void test_that_saveResult_will_throw_when_there_is_no_result_workspace_set() {
+    TS_ASSERT_THROWS(m_model->saveResult(), std::runtime_error);
+  }
+
+  void
+  test_that_getWorkspaceParameters_will_return_an_empty_vector_if_the_group_is_not_set() {
+    TS_ASSERT(m_model->getWorkspaceParameters("Result Group").empty());
+  }
+
+  void
+  test_that_getWorkspaceParameters_will_return_the_axis_labels_of_the_result_group() {
+    auto const axisLabels = getThreeAxisLabels();
+    auto const resultGroup = createGroupWorkspaceWithTextAxes(2, axisLabels, 3);
+
+    m_model->setResultWorkspace(resultGroup);
+
+    TS_ASSERT_EQUALS(m_model->getWorkspaceParameters("Result Group"),
+                     axisLabels);
+  }
+
+  void
+  test_that_getWorkspaceParameters_will_return_the_axis_labels_of_the_pdf_group() {
+    auto const axisLabels = getThreeAxisLabels();
+    auto const pdfGroup = createGroupWorkspaceWithTextAxes(2, axisLabels, 3);
+
+    m_model->setPDFWorkspace(pdfGroup);
+
+    TS_ASSERT_EQUALS(m_model->getWorkspaceParameters("PDF Group"), axisLabels);
+  }
+
+  void
+  test_that_getPDFWorkspaceNames_will_return_an_empty_vector_if_the_pdf_group_is_not_set() {
+    TS_ASSERT(m_model->getPDFWorkspaceNames().empty());
+  }
+
+  void
+  test_that_getPDFWorkspaceNames_will_return_the_expected_workspace_names_when_the_pdf_group_is_set() {
+    auto const pdfGroup =
+        createGroupWorkspaceWithTextAxes(2, getThreeAxisLabels(), 3);
+
+    m_model->setPDFWorkspace(pdfGroup);
+
+    /// Note that the names are blank because the workspaces haven't been named
+    for (auto const &name : m_model->getPDFWorkspaceNames())
+      TS_ASSERT_EQUALS(name, "");
+  }
+
+  void test_test() {}
+
+private:
+  std::unique_ptr<IndirectFitOutputOptionsModel> m_model;
+};
+
+#endif
diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFitOutputTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFitOutputTest.h
index 8f610241d1a..4bdb84e0281 100644
--- a/qt/scientific_interfaces/Indirect/test/IndirectFitOutputTest.h
+++ b/qt/scientific_interfaces/Indirect/test/IndirectFitOutputTest.h
@@ -1,3 +1,9 @@
+// Mantid Repository : https://github.com/mantidproject/mantid
+//
+// Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI,
+//     NScD Oak Ridge National Laboratory, European Spallation Source
+//     & Institut Laue - Langevin
+// SPDX - License - Identifier: GPL - 3.0 +
 #ifndef MANTID_INDIRECTFITOUTPUTTEST_H_
 #define MANTID_INDIRECTFITOUTPUTTEST_H_
 
diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFitPlotModelTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFitPlotModelTest.h
index d9471b0fc71..72b90f42743 100644
--- a/qt/scientific_interfaces/Indirect/test/IndirectFitPlotModelTest.h
+++ b/qt/scientific_interfaces/Indirect/test/IndirectFitPlotModelTest.h
@@ -1,3 +1,9 @@
+// Mantid Repository : https://github.com/mantidproject/mantid
+//
+// Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI,
+//     NScD Oak Ridge National Laboratory, European Spallation Source
+//     & Institut Laue - Langevin
+// SPDX - License - Identifier: GPL - 3.0 +
 #ifndef MANTID_INDIRECTFITPLOTMODELTEST_H_
 #define MANTID_INDIRECTFITPLOTMODELTEST_H_
 
diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFitPlotPresenterTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFitPlotPresenterTest.h
index f2347bd66d8..1eb790bfe6f 100644
--- a/qt/scientific_interfaces/Indirect/test/IndirectFitPlotPresenterTest.h
+++ b/qt/scientific_interfaces/Indirect/test/IndirectFitPlotPresenterTest.h
@@ -122,6 +122,7 @@ public:
   MOCK_METHOD1(enableFitRangeSelection, void(bool enable));
 
   MOCK_METHOD1(setFitSingleSpectrumText, void(QString const &text));
+  MOCK_METHOD1(setFitSingleSpectrumEnabled, void(bool enable));
 
   MOCK_METHOD1(setBackgroundLevel, void(double value));
 
@@ -635,4 +636,4 @@ private:
   SetUpADSWithWorkspace *m_ads;
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFittingModelTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFittingModelTest.h
index 810e972216a..536bb1266fd 100644
--- a/qt/scientific_interfaces/Indirect/test/IndirectFittingModelTest.h
+++ b/qt/scientific_interfaces/Indirect/test/IndirectFittingModelTest.h
@@ -1,3 +1,9 @@
+// Mantid Repository : https://github.com/mantidproject/mantid
+//
+// Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI,
+//     NScD Oak Ridge National Laboratory, European Spallation Source
+//     & Institut Laue - Langevin
+// SPDX - License - Identifier: GPL - 3.0 +
 #ifndef MANTID_INDIRECTFITTINGMODELTEST_H_
 #define MANTID_INDIRECTFITTINGMODELTEST_H_
 
@@ -696,11 +702,6 @@ public:
     TS_ASSERT(model->getResultLocation(0, 0));
   }
 
-  void test_that_saveResult_does_not_throw_when_saving_data_from_a_fit() {
-    auto const model = getModelWithFitOutputData();
-    TS_ASSERT_THROWS_NOTHING(model->saveResult());
-  }
-
   void
   test_that_cleanFailedRun_removes_the_temporary_workspace_from_the_ADS_when_a_fit_fails() {
     /// Fails the fit algorithm on purpose by providing an invalid function
-- 
GitLab