| 1 |
|
| 2 |
package jnr.netdb; |
| 3 |
|
| 4 |
import org.junit.After; |
| 5 |
import org.junit.AfterClass; |
| 6 |
import org.junit.Before; |
| 7 |
import org.junit.BeforeClass; |
| 8 |
import org.junit.Test; |
| 9 |
import static org.junit.Assert.*; |
| 10 |
|
| 11 |
/** |
| 12 |
* |
| 13 |
*/ |
| 14 |
public class ServiceTest { |
| 15 |
|
| 16 |
public ServiceTest() { |
| 17 |
} |
| 18 |
|
| 19 |
@BeforeClass |
| 20 |
public static void setUpClass() throws Exception { |
| 21 |
} |
| 22 |
|
| 23 |
@AfterClass |
| 24 |
public static void tearDownClass() throws Exception { |
| 25 |
} |
| 26 |
|
| 27 |
@Before |
| 28 |
public void setUp() { |
| 29 |
} |
| 30 |
|
| 31 |
@After |
| 32 |
public void tearDown() { |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
@Test public void canLookupBootpServiceByName() { |
| 38 |
Service s = Service.getServiceByName("bootps", "udp"); |
| 39 |
assertNotNull("could not lookup bootps service", s); |
| 40 |
assertEquals("incorrect port", 67, s.getPort()); |
| 41 |
assertEquals("incorrect name", "bootps", s.getName()); |
| 42 |
} |
| 43 |
|
| 44 |
@Test public void canLookupBootpServiceByPort() { |
| 45 |
Service s = Service.getServiceByPort(67, "udp"); |
| 46 |
assertNotNull("could not lookup bootps service", s); |
| 47 |
assertEquals("incorrect port", 67, s.getPort()); |
| 48 |
assertEquals("incorrect name", "bootps", s.getName()); |
| 49 |
} |
| 50 |
} |