From 7e7a68a61d582f16d5127bd2d1e6ca555d04ed4b Mon Sep 17 00:00:00 2001 From: zab <zab@mail.i2p> Date: Sat, 5 Jan 2013 23:21:04 +0000 Subject: [PATCH] fix BandwidthLimiterTest --- .../transport/BandwidthLimiterTest.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/router/java/test/junit/net/i2p/router/transport/BandwidthLimiterTest.java b/router/java/test/junit/net/i2p/router/transport/BandwidthLimiterTest.java index 30d1571f1b..f82162f27f 100644 --- a/router/java/test/junit/net/i2p/router/transport/BandwidthLimiterTest.java +++ b/router/java/test/junit/net/i2p/router/transport/BandwidthLimiterTest.java @@ -14,7 +14,11 @@ import java.io.OutputStream; import java.util.Properties; import java.util.Random; -import junit.framework.TestCase; +import org.junit.BeforeClass; +import org.junit.Test; + +import static junit.framework.TestCase.*; +import net.i2p.router.Router; import net.i2p.router.RouterContext; /** @@ -28,15 +32,14 @@ import net.i2p.router.RouterContext; * 10 concurrent threads is, well, slow. * */ -public class BandwidthLimiterTest extends TestCase{ - private RouterContext _context; +public class BandwidthLimiterTest { + private static RouterContext _context; private final static int NUM_KB = 256; - public void setUp() { - _context = new RouterContext(null); - } - - public void tearDown(){ + @BeforeClass + public static void setUp() { + _context = new RouterContext(new Router()); + _context.initAll(); } private void prepareLimiter(int inKBps, int outKBps, int inBurst, int outBurst) { @@ -102,6 +105,7 @@ public class BandwidthLimiterTest extends TestCase{ * with various limits) and log the times. * */ + @Test public void testOutbound() { double error; double predict; @@ -137,6 +141,7 @@ public class BandwidthLimiterTest extends TestCase{ * with various limits) and log the times. * */ + @Test public void testInbound() { double predict; double error; @@ -168,6 +173,7 @@ public class BandwidthLimiterTest extends TestCase{ } + @Test public void testOutboundContention() { double predict; double error; -- GitLab