tom | 931af4e | 2014-09-13 12:00:57 -0700 | [diff] [blame^] | 1 | package org.onlab.junit; |
| 2 | |
| 3 | import org.junit.Test; |
| 4 | |
| 5 | import static org.junit.Assert.*; |
| 6 | import static org.onlab.junit.TestTools.assertAfter; |
| 7 | |
| 8 | public class TestToolsTest { |
| 9 | |
| 10 | @Test |
| 11 | public void testSuccess() { |
| 12 | assertAfter(10, 100, new Runnable() { |
| 13 | int count = 0; |
| 14 | @Override |
| 15 | public void run() { |
| 16 | if (count++ < 3) { |
| 17 | assertTrue(false); |
| 18 | } |
| 19 | } |
| 20 | }); |
| 21 | } |
| 22 | |
| 23 | @Test(expected = AssertionError.class) |
| 24 | public void testFailure() { |
| 25 | assertAfter(100, new Runnable() { |
| 26 | @Override |
| 27 | public void run() { |
| 28 | assertTrue(false); |
| 29 | } |
| 30 | }); |
| 31 | } |
| 32 | } |