Skip to content

Commit

Permalink
Update apoptosis module tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicasyu committed Oct 16, 2023
1 parent b844d53 commit 618a9d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void stepEarly(MersenneTwisterFast random) {
void stepLate(MersenneTwisterFast random, Simulation sim) {
// Decrease size of cell.
cell.updateTarget(cytoBlebbingRate, LATE_SIZE_TARGET);
boolean sizeCheck = cell.getVolume() >= SIZE_CHECKPOINT
boolean sizeCheck = cell.getVolume() <= SIZE_CHECKPOINT
* LATE_SIZE_TARGET * cell.getCriticalVolume();

// Decrease size of nucleus (if cell has regions).
Expand Down
23 changes: 16 additions & 7 deletions test/arcade/potts/agent/module/PottsModuleApoptosisSimpleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public static void setupMocks() {
parameters.put("apoptosis/RATE_LATE", randomDoubleBetween(1, 10));
parameters.put("apoptosis/STEPS_EARLY", randomIntBetween(1, 100));
parameters.put("apoptosis/STEPS_LATE", randomIntBetween(1, 100));
parameters.put("apoptosis/WATER_LOSS_RATE", randomDoubleBetween(100, 500));
parameters.put("apoptosis/CYTOPLASMIC_BLEBBING_RATE", randomDoubleBetween(100, 500));
parameters.put("apoptosis/NUCLEUS_PYKNOSIS_RATE", randomDoubleBetween(0, 100));
parameters.put("apoptosis/NUCLEUS_FRAGMENTATION_RATE", randomDoubleBetween(0, 100));
}

@Test
Expand All @@ -67,6 +71,11 @@ public void constructor_setsParameters() {
assertEquals(parameters.getDouble("apoptosis/RATE_LATE"), module.rateLate, EPSILON);
assertEquals(parameters.getDouble("apoptosis/STEPS_EARLY"), module.stepsEarly, EPSILON);
assertEquals(parameters.getDouble("apoptosis/STEPS_LATE"), module.stepsLate, EPSILON);
assertEquals(parameters.getDouble("apoptosis/WATER_LOSS_RATE"), module.waterLossRate, EPSILON);
assertEquals(parameters.getDouble("apoptosis/CYTOPLASMIC_BLEBBING_RATE"), module.cytoBlebbingRate, EPSILON);
assertEquals(parameters.getDouble("apoptosis/NUCLEUS_PYKNOSIS_RATE"), module.nucleusPyknosisRate, EPSILON);
assertEquals(parameters.getDouble("apoptosis/NUCLEUS_FRAGMENTATION_RATE"),
module.nucleusFragmentationRate, EPSILON);
}

@Test
Expand Down Expand Up @@ -125,7 +134,7 @@ public void stepEarly_anyTransition_updatesCell() {
module.currentSteps = 0;
module.stepEarly(random);

verify(cell, times(2)).updateTarget(module.waterLossRate, EARLY_SIZE_CHECKPOINT);
verify(cell, times(2)).updateTarget(module.waterLossRate, EARLY_SIZE_TARGET);
}

@Test
Expand All @@ -144,7 +153,7 @@ public void stepEarly_anyTransitionWithRegion_updatesCell() {
module.currentSteps = 0;
module.stepEarly(random);

verify(cell, times(2)).updateTarget(Region.NUCLEUS, module.nucleusPyknosisRate, EARLY_SIZE_CHECKPOINT);
verify(cell, times(2)).updateTarget(Region.NUCLEUS, module.nucleusPyknosisRate, EARLY_SIZE_TARGET);
}

@Test
Expand All @@ -153,7 +162,7 @@ public void stepLate_withTransitionNotArrested_updatesPhase() {
PottsCell cell = mock(PottsCell.class);
doReturn(parameters).when(cell).getParameters();
double volume = randomDoubleBetween(0, 100);
doReturn((volume * LATE_SIZE_CHECKPOINT) - 1).when(cell).getVolume();
doReturn((volume * SIZE_CHECKPOINT * LATE_SIZE_TARGET) - 1).when(cell).getVolume();
doReturn(volume).when(cell).getCriticalVolume();

PottsModuleApoptosisSimple module = spy(new PottsModuleApoptosisSimple(cell));
Expand All @@ -179,7 +188,7 @@ public void stepLate_withoutTransitionNotArrested_maintainsPhase() {
PottsCell cell = mock(PottsCell.class);
doReturn(parameters).when(cell).getParameters();
double volume = randomDoubleBetween(0, 100);
doReturn((volume * LATE_SIZE_CHECKPOINT) - 1).when(cell).getVolume();
doReturn((volume * SIZE_CHECKPOINT * LATE_SIZE_TARGET) - 1).when(cell).getVolume();
doReturn(volume).when(cell).getCriticalVolume();

PottsModuleApoptosisSimple module = spy(new PottsModuleApoptosisSimple(cell));
Expand All @@ -206,7 +215,7 @@ public void stepLate_withTransitionArrested_maintainsPhase() {
PottsCell cell = mock(PottsCell.class);
doReturn(parameters).when(cell).getParameters();
double volume = randomDoubleBetween(0, 100);
doReturn((volume * LATE_SIZE_CHECKPOINT) + 1).when(cell).getVolume();
doReturn((volume * SIZE_CHECKPOINT * LATE_SIZE_TARGET) + 1).when(cell).getVolume();
doReturn(volume).when(cell).getCriticalVolume();

PottsModuleApoptosisSimple module = spy(new PottsModuleApoptosisSimple(cell));
Expand All @@ -232,7 +241,7 @@ public void stepLate_withoutTransitionArrested_maintainsPhase() {
PottsCell cell = mock(PottsCell.class);
doReturn(parameters).when(cell).getParameters();
double volume = randomDoubleBetween(0, 100);
doReturn((volume * LATE_SIZE_CHECKPOINT) + 1).when(cell).getVolume();
doReturn((volume * SIZE_CHECKPOINT * LATE_SIZE_TARGET) + 1).when(cell).getVolume();
doReturn(volume).when(cell).getCriticalVolume();

PottsModuleApoptosisSimple module = spy(new PottsModuleApoptosisSimple(cell));
Expand Down Expand Up @@ -269,7 +278,7 @@ public void stepLate_anyTransition_updatesCell() {
module.currentSteps = 0;
module.stepLate(random, simMock);

verify(cell, times(2)).updateTarget(module.cytoBlebbingRate, LATE_SIZE_CHECKPOINT);
verify(cell, times(2)).updateTarget(module.cytoBlebbingRate, LATE_SIZE_TARGET);
}

@Test
Expand Down

0 comments on commit 618a9d4

Please sign in to comment.