diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-03-02 15:34:39 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-03-02 15:34:39 +0100 |
commit | 3844b4dbcc5e03489e82924ac2e1707897f9e43e (patch) | |
tree | fa450261161697fc44cd89b68ef97ed1afa5e575 /clustercontroller-utils | |
parent | 8ec5743e254b039fe860339fdc4b5ab4aa1f0364 (diff) |
Remove junit.fdramework usage
Diffstat (limited to 'clustercontroller-utils')
7 files changed, 46 insertions, 22 deletions
diff --git a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/communication/http/AsyncHttpClientWithBaseTest.java b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/communication/http/AsyncHttpClientWithBaseTest.java index 685ad492052..d943c8d96f0 100644 --- a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/communication/http/AsyncHttpClientWithBaseTest.java +++ b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/communication/http/AsyncHttpClientWithBaseTest.java @@ -5,9 +5,7 @@ import com.yahoo.vespa.clustercontroller.utils.communication.async.AsyncOperatio import com.yahoo.vespa.clustercontroller.utils.communication.async.AsyncOperationImpl; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; public class AsyncHttpClientWithBaseTest { @@ -46,9 +44,9 @@ public class AsyncHttpClientWithBaseTest { @Test public void testClientMustBeSet() { - try { + try{ new AsyncHttpClientWithBase<>(null); - assertTrue(false); + fail(); } catch (IllegalArgumentException e) { } } diff --git a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/communication/http/JsonHttpResultTest.java b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/communication/http/JsonHttpResultTest.java index 8265247b124..fc843979d75 100644 --- a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/communication/http/JsonHttpResultTest.java +++ b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/communication/http/JsonHttpResultTest.java @@ -17,12 +17,12 @@ public class JsonHttpResultTest { @Test public void testOutput() { assertEquals("HTTP 200/OK\n" - + "\n" - + "JSON: {\"foo\": 3}", + + "\n" + + "JSON: {\"foo\": 3}", new JsonHttpResult(new HttpResult().setContent("{ \"foo\" : 3 }")).toString(true)); assertEquals("HTTP 200/OK\n" - + "\n" - + "{ \"foo\" : }", + + "\n" + + "{ \"foo\" : }", new JsonHttpResult(new HttpResult().setContent("{ \"foo\" : }")).toString(true)); } diff --git a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/test/FakeClockTest.java b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/test/FakeClockTest.java index 900be069623..47edd7ac55c 100644 --- a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/test/FakeClockTest.java +++ b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/test/FakeClockTest.java @@ -1,10 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.utils.test; -import junit.framework.TestCase; +import org.junit.Test; -public class FakeClockTest extends TestCase { +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +public class FakeClockTest { + + @Test public void testSimple() { FakeClock clock = new FakeClock(); // Should not start at 0, as that is common not initialized yet value @@ -21,9 +25,9 @@ public class FakeClockTest extends TestCase { assertEquals(start + 15, clock.getTimeInMillis()); } - /** - * @todo This should probably throw exceptions.. However, that doesn't seem to be current behavior. I suspect some tests misuse the clock to reset things to run another test. Should probably be fixed. - */ + // TODO: This should probably throw exceptions.. However, that doesn't seem to be current behavior. + // I suspect some tests misuse the clock to reset things to run another test. Should probably be fixed. + @Test public void testTurnTimeBack() { FakeClock clock = new FakeClock(); clock.set(1000); @@ -34,4 +38,5 @@ public class FakeClockTest extends TestCase { clock.adjust(-100); assertEquals(400, clock.getTimeInMillis()); } + } diff --git a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/CertainlyCloneableTest.java b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/CertainlyCloneableTest.java index c3a428437d0..b4fa6492c6d 100644 --- a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/CertainlyCloneableTest.java +++ b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/CertainlyCloneableTest.java @@ -1,9 +1,12 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.utils.util; -import junit.framework.TestCase; +import org.junit.Test; -public class CertainlyCloneableTest extends TestCase { +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class CertainlyCloneableTest { private class Foo extends CertainlyCloneable<Foo> { protected Foo callParentClone() throws CloneNotSupportedException { @@ -11,6 +14,7 @@ public class CertainlyCloneableTest extends TestCase { } } + @Test public void testSimple() { try{ Foo f = new Foo(); @@ -20,4 +24,5 @@ public class CertainlyCloneableTest extends TestCase { assertEquals("Foo", e.getCause().getMessage()); } } + } diff --git a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/ClockTest.java b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/ClockTest.java index fbd34297953..4d46903c090 100644 --- a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/ClockTest.java +++ b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/ClockTest.java @@ -1,13 +1,17 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.utils.util; -import junit.framework.TestCase; +import org.junit.Test; -public class ClockTest extends TestCase { +import static org.junit.Assert.assertTrue; +public class ClockTest { + + @Test public void testNothingButGetCoverage() { long s = new Clock().getTimeInSecs(); long ms = new Clock().getTimeInMillis(); assertTrue(ms >= 1000 * s); } + } diff --git a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/JSONObjectWrapperTest.java b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/JSONObjectWrapperTest.java index 2250901e4e1..8dbdbb11c95 100644 --- a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/JSONObjectWrapperTest.java +++ b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/JSONObjectWrapperTest.java @@ -1,10 +1,13 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.utils.util; -import junit.framework.TestCase; +import org.junit.Test; -public class JSONObjectWrapperTest extends TestCase { +import static org.junit.Assert.assertEquals; +public class JSONObjectWrapperTest { + + @Test public void testExceptionWrapping() { JSONObjectWrapper wrapper = new JSONObjectWrapper(); try{ @@ -13,4 +16,5 @@ public class JSONObjectWrapperTest extends TestCase { assertEquals("Null key.", e.getMessage()); } } + } diff --git a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/MetricReporterTest.java b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/MetricReporterTest.java index 332f0a36327..d085015065a 100644 --- a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/MetricReporterTest.java +++ b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/MetricReporterTest.java @@ -1,12 +1,15 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.utils.util; -import junit.framework.TestCase; +import org.junit.Test; import java.util.Map; import java.util.TreeMap; -public class MetricReporterTest extends TestCase { +import static org.junit.Assert.assertEquals; + +public class MetricReporterTest { + static class MetricReporterMock implements MetricReporter { StringBuilder sb = new StringBuilder(); @@ -30,6 +33,7 @@ public class MetricReporterTest extends TestCase { } }; + @Test public void testNoMetricReporter() { NoMetricReporter reporter = new NoMetricReporter(); reporter.add("foo", 3, null); @@ -37,6 +41,7 @@ public class MetricReporterTest extends TestCase { reporter.createContext(null); } + @Test public void testPrefix() { MetricReporterMock mock = new MetricReporterMock(); ComponentMetricReporter c = new ComponentMetricReporter(mock, "prefix"); @@ -51,6 +56,7 @@ public class MetricReporterTest extends TestCase { } + @Test public void testWithContext() { MetricReporterMock mock = new MetricReporterMock(); ComponentMetricReporter c = new ComponentMetricReporter(mock, "prefix"); @@ -68,6 +74,7 @@ public class MetricReporterTest extends TestCase { "set(prefixbar, 1)\n", mock.sb.toString()); } + @Test public void testDefaultContext() { MetricReporterMock mock = new MetricReporterMock(); ComponentMetricReporter c = new ComponentMetricReporter(mock, "prefix"); @@ -79,6 +86,7 @@ public class MetricReporterTest extends TestCase { "add(prefixfoo, 2)\n", mock.sb.toString()); } + @Test public void testContextOverlap() { MetricReporterMock mock = new MetricReporterMock(); ComponentMetricReporter c = new ComponentMetricReporter(mock, "prefix"); |