blob: 8c2815c8646b748f7d7158a17f8f56b18ea9d470 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.concurrent;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author mpolden
*/
public class OnceTest {
@Test
@Timeout(60_000)
void test_run() throws Exception {
CountDownLatch latch = new CountDownLatch(1);
Once.after(Duration.ZERO, latch::countDown);
assertTrue(latch.await(30, TimeUnit.SECONDS));
}
}
|