blob: 4d79eb0e4154fe576ea7a4f6022b13ac66a7c68d (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.service;
import com.google.inject.Inject;
import com.yahoo.jdisc.application.ContainerBuilder;
import com.yahoo.jdisc.test.TestDriver;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Simon Thoresen Hult
*/
public class AbstractServerProviderTestCase {
@Test
void requireThatAbstractClassIsAServerProvider() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
assertTrue(ServerProvider.class.isInstance(new MyServerProvider(driver)));
assertTrue(driver.close());
}
@Test
void requireThatAccessorsWork() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
MyServerProvider server = builder.getInstance(MyServerProvider.class);
assertNotNull(server.container());
assertTrue(driver.close());
}
private static class MyServerProvider extends AbstractServerProvider {
@Inject
public MyServerProvider(CurrentContainer container) {
super(container);
}
@Override
public void start() {
}
@Override
public void close() {
}
}
}
|