Skip to content
Snippets Groups Projects
Commit 95d9da4f authored by felmer's avatar felmer
Browse files

SE-137 tests fixed

SVN: 12531
parent cd790f63
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,7 @@ public class AbundanceHandlerTest extends AssertJUnit ...@@ -49,7 +49,7 @@ public class AbundanceHandlerTest extends AssertJUnit
private static final double ABUNDANCE = 1234.5; private static final double ABUNDANCE = 1234.5;
private static final String PARAMETER_NAME = "abc12"; private static final String PARAMETER_NAME = "abc12";
private static final SampleIdentifier SAMPLE_IDENTIFER = private static final SampleIdentifier SAMPLE_IDENTIFER =
new SampleIdentifier(GROUP_IDENTIFIER, PARAMETER_NAME.toUpperCase()); new SampleIdentifier(GROUP_IDENTIFIER, PARAMETER_NAME);
private static final String SAMPLE_PERM_ID = "s12-34"; private static final String SAMPLE_PERM_ID = "s12-34";
private static final String EXPERIMENT_PERM_ID = "e12345-42"; private static final String EXPERIMENT_PERM_ID = "e12345-42";
private static final long EXPERIMENT_ID = 42; private static final long EXPERIMENT_ID = 42;
...@@ -57,8 +57,8 @@ public class AbundanceHandlerTest extends AssertJUnit ...@@ -57,8 +57,8 @@ public class AbundanceHandlerTest extends AssertJUnit
private static final long PROTEIN_ID = 4711; private static final long PROTEIN_ID = 4711;
private static final String PROTEIN_NAME = "my protein"; private static final String PROTEIN_NAME = "my protein";
private static final ListSamplesByPropertyCriteria CRITERIA = private static final ListSamplesByPropertyCriteria CRITERIA =
new ListSamplesByPropertyCriteria(AbundanceHandler.MZXML_FILENAME, PARAMETER_NAME new ListSamplesByPropertyCriteria(AbundanceHandler.MZXML_FILENAME, PARAMETER_NAME,
.toUpperCase(), GROUP_IDENTIFIER.getGroupCode(), null); GROUP_IDENTIFIER.getGroupCode(), null);
private Mockery context; private Mockery context;
...@@ -138,8 +138,8 @@ public class AbundanceHandlerTest extends AssertJUnit ...@@ -138,8 +138,8 @@ public class AbundanceHandlerTest extends AssertJUnit
} catch (UserFailureException e) } catch (UserFailureException e)
{ {
assertEquals("Protein '" + PROTEIN_NAME assertEquals("Protein '" + PROTEIN_NAME
+ "' has an abundance value for an unidentified sample: " + "' has an abundance value for an unidentified sample: " + PARAMETER_NAME, e
+ PARAMETER_NAME.toUpperCase(), e.getMessage()); .getMessage());
} }
try try
...@@ -149,31 +149,32 @@ public class AbundanceHandlerTest extends AssertJUnit ...@@ -149,31 +149,32 @@ public class AbundanceHandlerTest extends AssertJUnit
} catch (UserFailureException e) } catch (UserFailureException e)
{ {
assertEquals("Protein '" + PROTEIN_NAME assertEquals("Protein '" + PROTEIN_NAME
+ "' has an abundance value for an unidentified sample: " + "' has an abundance value for an unidentified sample: " + PARAMETER_NAME, e
+ PARAMETER_NAME.toUpperCase(), e.getMessage()); .getMessage());
} }
context.assertIsSatisfied(); context.assertIsSatisfied();
} }
@Test @Test
public void testAddAbundanceValuesForASampleIdentifiedByPropertyButTwoSamplesFound() public void testAddAbundanceValuesForASampleIdentifiedByPropertyButTwoSamplesFound()
{ {
Sample sample = new Sample(); Sample sample = new Sample();
sample.setPermId(SAMPLE_PERM_ID); sample.setPermId(SAMPLE_PERM_ID);
prepareCreateSampleIdentifiedByProperty(Arrays.<Sample>asList(sample, sample)); prepareCreateSampleIdentifiedByProperty(Arrays.<Sample> asList(sample, sample));
try try
{ {
handler.addAbundancesToDatabase(createParameter(PARAMETER_VALUE), PROTEIN_ID, PROTEIN_NAME); handler.addAbundancesToDatabase(createParameter(PARAMETER_VALUE), PROTEIN_ID,
PROTEIN_NAME);
fail("UserFailureException expected"); fail("UserFailureException expected");
} catch (UserFailureException e) } catch (UserFailureException e)
{ {
assertEquals("Protein '" + PROTEIN_NAME assertEquals("Protein '" + PROTEIN_NAME
+ "' has an abundance value for a not uniquely specified sample " + "' has an abundance value for a not uniquely specified sample "
+ "(2 samples are found): " + PARAMETER_NAME.toUpperCase(), e.getMessage()); + "(2 samples are found): " + PARAMETER_NAME, e.getMessage());
} }
context.assertIsSatisfied(); context.assertIsSatisfied();
} }
......
...@@ -244,8 +244,7 @@ public class ResultDataSetUploaderTest extends AssertJUnit ...@@ -244,8 +244,7 @@ public class ResultDataSetUploaderTest extends AssertJUnit
p1.getParameters().add(createAbundance(CELL_LYSATE1, 2.5)); p1.getParameters().add(createAbundance(CELL_LYSATE1, 2.5));
p1.getParameters().add(new Parameter()); p1.getParameters().add(new Parameter());
final SampleIdentifier sampleIdentifier = final SampleIdentifier sampleIdentifier =
new SampleIdentifier(new GroupIdentifier(DB_INSTANCE, GROUP_CODE), CELL_LYSATE1 new SampleIdentifier(new GroupIdentifier(DB_INSTANCE, GROUP_CODE), CELL_LYSATE1);
.toUpperCase());
context.checking(new Expectations() context.checking(new Expectations()
{ {
{ {
...@@ -299,12 +298,11 @@ public class ResultDataSetUploaderTest extends AssertJUnit ...@@ -299,12 +298,11 @@ public class ResultDataSetUploaderTest extends AssertJUnit
p1.getParameters().add(createAbundance(CELL_LYSATE1, 2.5)); p1.getParameters().add(createAbundance(CELL_LYSATE1, 2.5));
p1.getParameters().add(new Parameter()); p1.getParameters().add(new Parameter());
final GroupIdentifier groupIdentifier = new GroupIdentifier(DB_INSTANCE, GROUP_CODE); final GroupIdentifier groupIdentifier = new GroupIdentifier(DB_INSTANCE, GROUP_CODE);
String upperCaseParameterName = CELL_LYSATE1.toUpperCase();
final SampleIdentifier sampleIdentifier = final SampleIdentifier sampleIdentifier =
new SampleIdentifier(groupIdentifier, upperCaseParameterName); new SampleIdentifier(groupIdentifier, CELL_LYSATE1);
final ListSamplesByPropertyCriteria criteria = final ListSamplesByPropertyCriteria criteria =
new ListSamplesByPropertyCriteria(AbundanceHandler.MZXML_FILENAME, new ListSamplesByPropertyCriteria(AbundanceHandler.MZXML_FILENAME,
upperCaseParameterName, GROUP_CODE, null); CELL_LYSATE1, GROUP_CODE, null);
context.checking(new Expectations() context.checking(new Expectations()
{ {
{ {
...@@ -338,7 +336,7 @@ public class ResultDataSetUploaderTest extends AssertJUnit ...@@ -338,7 +336,7 @@ public class ResultDataSetUploaderTest extends AssertJUnit
{ {
AssertionUtil.assertContains("Protein '" + PROTEIN_NAME1 AssertionUtil.assertContains("Protein '" + PROTEIN_NAME1
+ "' has an abundance value for an unidentified sample: " + "' has an abundance value for an unidentified sample: "
+ upperCaseParameterName, ex.getMessage()); + CELL_LYSATE1, ex.getMessage());
} }
context.assertIsSatisfied(); context.assertIsSatisfied();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment