summaryrefslogtreecommitdiffstats
path: root/container-disc/src/test
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2020-12-07 13:37:24 +0100
committerJon Marius Venstad <venstad@gmail.com>2020-12-07 13:37:24 +0100
commitbdb102917700d9f698423b5a1d62ead8a06f5b5a (patch)
tree1daacf13716d072b1a5578ae03fb35ae2e61a81f /container-disc/src/test
parentc7548568b93ac5552667ca34a754bf6b36b5033e (diff)
Always deconstruct in reverse creation order, including Provider objects
Diffstat (limited to 'container-disc/src/test')
-rw-r--r--container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java b/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java
index efdc8f44c17..6263bb4ecd5 100644
--- a/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java
+++ b/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java
@@ -9,6 +9,8 @@ import com.yahoo.jdisc.SharedResource;
import org.junit.Before;
import org.junit.Test;
+import java.util.List;
+
import static java.util.Collections.emptyList;
import static java.util.Collections.singleton;
import static org.junit.Assert.assertTrue;
@@ -28,7 +30,7 @@ public class DeconstructorTest {
public void require_abstract_component_destructed() throws InterruptedException {
TestAbstractComponent abstractComponent = new TestAbstractComponent();
// Done by executor, so it takes some time even with a 0 delay.
- deconstructor.deconstruct(singleton(abstractComponent), emptyList());
+ deconstructor.deconstruct(List.of(abstractComponent), emptyList());
int cnt = 0;
while (! abstractComponent.destructed && (cnt++ < 12000)) {
Thread.sleep(10);
@@ -39,14 +41,14 @@ public class DeconstructorTest {
@Test
public void require_provider_destructed() {
TestProvider provider = new TestProvider();
- deconstructor.deconstruct(singleton(provider), emptyList());
+ deconstructor.deconstruct(List.of(provider), emptyList());
assertTrue(provider.destructed);
}
@Test
public void require_shared_resource_released() {
TestSharedResource sharedResource = new TestSharedResource();
- deconstructor.deconstruct(singleton(sharedResource), emptyList());
+ deconstructor.deconstruct(List.of(sharedResource), emptyList());
assertTrue(sharedResource.released);
}