Skip to content

Commit

Permalink
Fixup other jmock related test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nbauernfeind committed Oct 22, 2024
1 parent bcd681e commit fbb377f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,15 @@ public final synchronized boolean isEmpty() {
protected void destroy() {
super.destroy();
for (final EmptyTableLocationEntry entry : emptyTableLocations.values()) {
entry.subscriptionBuffer.reset();
if (entry.subscriptionBuffer != null) {
entry.subscriptionBuffer.reset();
}
}
emptyTableLocations.clear();
for (final IncludedTableLocationEntry entry : includedTableLocations.values()) {
entry.subscriptionBuffer.reset();
if (entry.subscriptionBuffer != null) {
entry.subscriptionBuffer.reset();
}
}
includedTableLocations.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public void setUp() throws Exception {
@Override
public void tearDown() throws Exception {
try {
allowLivenessRelease();
super.tearDown();
} finally {
if (coalesced != null) {
Expand All @@ -174,6 +175,22 @@ public void tearDown() throws Exception {
}
}

private void allowLivenessRelease() {
checking(new Expectations() {
{
allowing(locationProvider).supportsSubscriptions();
allowing(locationProvider).unsubscribe(with(any(TableLocationProvider.Listener.class)));
will(returnValue(true));
for (int li = 0; li < tableLocations.length; ++li) {
final TableLocation tableLocation = tableLocations[li];
allowing(tableLocation).supportsSubscriptions();
will(returnValue(true));
allowing(tableLocation).unsubscribe(with(any(TableLocation.Listener.class)));
}
}
});
}

private Map<String, ? extends ColumnSource<?>> getIncludedColumnsMap(final int... indices) {
return IntStream.of(indices)
.mapToObj(ci -> new Pair<>(TABLE_DEFINITION.getColumns().get(ci).getName(), columnSources[ci]))
Expand Down Expand Up @@ -396,6 +413,7 @@ public Object invoke(Invocation invocation) {
errorNotification.reset();
final ControlledUpdateGraph updateGraph = ExecutionContext.getContext().getUpdateGraph().cast();
updateGraph.runWithinUnitTestCycle(() -> {
allowLivenessRelease();
SUT.refresh();
updateGraph.markSourcesRefreshedForUnitTests();
}, false);
Expand Down

0 comments on commit fbb377f

Please sign in to comment.