blob: c6230e928b72fbdf49e0192c569dfb60c10967c8 (
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 2016 Yahoo Inc. 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.Test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
*/
public class AbstractServerProviderTestCase {
@Test
public void requireThatAbstractClassIsAServerProvider() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
assertTrue(ServerProvider.class.isInstance(new MyServerProvider(driver)));
assertTrue(driver.close());
}
@Test
public 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() {
}
}
}
|