Skip to content
Snippets Groups Projects
Commit 0b818d59 authored by jakubs's avatar jakubs
Browse files

BIS-291 SP-450 fix the sample update builder to not remove container

from sample with every update.
Ammend test class to test the correct behaviour

SVN: 28090
parent fc1d8f12
No related branches found
No related tags found
No related merge requests found
...@@ -86,29 +86,6 @@ public class UnassignSampleFromSpaceTest extends BaseTest ...@@ -86,29 +86,6 @@ public class UnassignSampleFromSpaceTest extends BaseTest
perform(anUpdateOf(sample).removingSpace()); perform(anUpdateOf(sample).removingSpace());
} }
@Test
public void childSampleCanBeUnassignedFromSpace() throws Exception
{
Sample parent = create(aSample().inExperiment(experiment));
Sample child = create(aSample().withParent(parent).inExperiment(experiment));
perform(anUpdateOf(child).removingSpace());
assertThat(child, hasNoSpace());
}
@Test
public void spaceAssignmentOfParentSampleIsNotChangedWhenChildSampleIsUnassignedFromSpace()
throws Exception
{
Sample parent = create(aSample().inExperiment(experiment));
Sample child = create(aSample().withParent(parent).inExperiment(experiment));
perform(anUpdateOf(child).removingSpace());
assertThat(parent, is(inSpace(space)));
}
@Test(expectedExceptions = @Test(expectedExceptions =
{ UserFailureException.class }) { UserFailureException.class })
public void childSampleCantBeUnassignedFromSpace() throws Exception public void childSampleCantBeUnassignedFromSpace() throws Exception
...@@ -117,8 +94,6 @@ public class UnassignSampleFromSpaceTest extends BaseTest ...@@ -117,8 +94,6 @@ public class UnassignSampleFromSpaceTest extends BaseTest
Sample child = create(aSample().withParent(parent).inExperiment(experiment)); Sample child = create(aSample().withParent(parent).inExperiment(experiment));
perform(anUpdateOf(child).removingSpace()); perform(anUpdateOf(child).removingSpace());
assertThat(child, hasNoSpace());
} }
@Test @Test
...@@ -144,15 +119,14 @@ public class UnassignSampleFromSpaceTest extends BaseTest ...@@ -144,15 +119,14 @@ public class UnassignSampleFromSpaceTest extends BaseTest
assertThat(child, is(inSpace(space))); assertThat(child, is(inSpace(space)));
} }
@Test @Test(expectedExceptions =
{ UserFailureException.class })
public void componentOfSpaceLevelSampleCanBeUnassignedFromSpace() throws Exception public void componentOfSpaceLevelSampleCanBeUnassignedFromSpace() throws Exception
{ {
Sample container = create(aSample().inExperiment(experiment)); Sample container = create(aSample().inExperiment(experiment));
Sample component = create(aSample().inExperiment(experiment).inContainer(container)); Sample component = create(aSample().inExperiment(experiment).inContainer(container));
perform(anUpdateOf(component).removingSpace()); perform(anUpdateOf(component).removingSpace());
assertThat(component, hasNoSpace());
} }
@Test @Test
......
...@@ -65,7 +65,7 @@ public class SampleUpdateBuilder extends UpdateBuilder<SampleUpdatesDTO> ...@@ -65,7 +65,7 @@ public class SampleUpdateBuilder extends UpdateBuilder<SampleUpdatesDTO>
this.version = sample.getVersion(); this.version = sample.getVersion();
this.sampleIdentifier = id(sample); this.sampleIdentifier = id(sample);
this.parents = null; this.parents = null;
this.container = null; this.container = sample.getContainer();
} }
public SampleUpdateBuilder toExperiment(Experiment experiment) public SampleUpdateBuilder toExperiment(Experiment experiment)
......
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