Skip to content

Commit

Permalink
Add test for absence of file or string re #8546
Browse files Browse the repository at this point in the history
Also correct the error message.

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Dec 10, 2013
1 parent 254d757 commit f496828
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Expand Up @@ -104,7 +104,7 @@ void LoadParameterFile::exec()

// Check the two properties (at least one must be set)
if( filename.empty() && parameterXMLProperty->isDefault()){
throw Kernel::Exception::FileError("Either the Filename or ParameterXML property of LoadInstrument most be specified to load an IDF" , filename);
throw Kernel::Exception::FileError("Either the Filename or ParameterXML property of LoadParameterFile most be specified to load an IDF" , filename);
}

// Get the input workspace
Expand Down
13 changes: 13 additions & 0 deletions Code/Mantid/Framework/DataHandling/test/LoadParameterFileTest.h
Expand Up @@ -135,6 +135,19 @@ class LoadParameterFileTest : public CxxTest::TestSuite

}

void test_failure_if_no_file_or_string()
{
// Create workspace
load_IDF2();

// Run algorithm without file or string properties set
LoadParameterFile loaderPF;
TS_ASSERT_THROWS_NOTHING(loaderPF.initialize());
loaderPF.setPropertyValue("Workspace", wsName);
TS_ASSERT_THROWS_NOTHING(loaderPF.execute());
TS_ASSERT( ! loaderPF.execute() )
}

void load_IDF2()
{
LoadInstrument loaderIDF2;
Expand Down

0 comments on commit f496828

Please sign in to comment.