tom | 5ac5188 | 2014-08-27 18:10:33 -0700 | [diff] [blame] | 1 | package org.onlab.onos.impl; |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 2 | |
| 3 | import org.junit.Test; |
tom | 5ac5188 | 2014-08-27 18:10:33 -0700 | [diff] [blame] | 4 | import org.onlab.onos.GreetService; |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 5 | |
| 6 | import java.util.Iterator; |
| 7 | |
| 8 | import static org.junit.Assert.assertEquals; |
| 9 | import static org.junit.Assert.assertFalse; |
| 10 | |
| 11 | /** |
| 12 | * Example of a component & service implementation unit test. |
| 13 | */ |
| 14 | public class GreetManagerTest { |
| 15 | |
| 16 | @Test |
| 17 | public void basics() { |
| 18 | GreetService service = new GreetManager(); |
| 19 | assertEquals("incorrect greeting", "Whazup dude?", service.yo("dude")); |
| 20 | |
| 21 | Iterator<String> names = service.names().iterator(); |
| 22 | assertEquals("incorrect name", "dude", names.next()); |
| 23 | assertFalse("no more names expected", names.hasNext()); |
| 24 | } |
| 25 | |
| 26 | @Test(expected = NullPointerException.class) |
| 27 | public void nullArg() { |
| 28 | new GreetManager().yo(null); |
| 29 | } |
| 30 | |
| 31 | } |