diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-08-12 10:34:39 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-08-12 10:34:39 +0000 |
commit | 38285e0e1147042b519957958083e537e6d90fc9 (patch) | |
tree | 317bcc846acb2bc8365ca2aedb76d9066152de40 /standalone-container/src | |
parent | 104f7547cb92ab39251308f15ddc45d515a48ae2 (diff) |
Minor unification of tests.
Diffstat (limited to 'standalone-container/src')
2 files changed, 14 insertions, 16 deletions
diff --git a/standalone-container/src/test/java/com/yahoo/container/standalone/CloudConfigInstallVariablesTest.java b/standalone-container/src/test/java/com/yahoo/container/standalone/CloudConfigInstallVariablesTest.java index 1cd110d8106..9e5d2b694df 100644 --- a/standalone-container/src/test/java/com/yahoo/container/standalone/CloudConfigInstallVariablesTest.java +++ b/standalone-container/src/test/java/com/yahoo/container/standalone/CloudConfigInstallVariablesTest.java @@ -11,9 +11,8 @@ import java.util.stream.Collectors; import static com.yahoo.container.standalone.CloudConfigInstallVariables.toConfigModelsPluginDir; import static com.yahoo.container.standalone.CloudConfigInstallVariables.toConfigServer; import static com.yahoo.container.standalone.CloudConfigInstallVariables.toConfigServers; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.contains; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen @@ -24,23 +23,23 @@ public class CloudConfigInstallVariablesTest { @Test public void test_configserver_parsing() { CloudConfigOptions.ConfigServer[] parsed = toConfigServers("myhost.mydomain.com"); - assertThat(parsed.length, is(1)); + assertEquals(1, parsed.length); } @Test public void port_can_be_configured() { CloudConfigOptions.ConfigServer[] parsed = toConfigServers("myhost:123"); int port = parsed[0].port.get(); - assertThat(port, is(123)); + assertEquals(123, port); } @Test public void multiple_spaces_are_supported() { CloudConfigOptions.ConfigServer[] parsed = toConfigServers("test1 test2"); - assertThat(parsed.length, is(2)); + assertEquals(2, parsed.length); List<String> hostNames = Arrays.stream(parsed).map(cs -> cs.hostName).collect(Collectors.toList()); - assertThat(hostNames, contains("test1", "test2")); + assertTrue(hostNames.containsAll(Arrays.asList("test1", "test2"))); } @Test(expected = IllegalArgumentException.class) @@ -56,12 +55,12 @@ public class CloudConfigInstallVariablesTest { @Test public void string_arrays_are_split_on_spaces() { String[] parsed = toConfigModelsPluginDir("/home/vespa/foo /home/vespa/bar "); - assertThat(parsed.length, is(2)); + assertEquals(2, parsed.length); } @Test public void string_arrays_are_split_on_comma() { String[] parsed = toConfigModelsPluginDir("/home/vespa/foo,/home/vespa/bar,"); - assertThat(parsed.length, is(2)); + assertEquals(2, parsed.length); } } diff --git a/standalone-container/src/test/java/com/yahoo/container/standalone/StandaloneSubscriberTest.java b/standalone-container/src/test/java/com/yahoo/container/standalone/StandaloneSubscriberTest.java index 8ca20fdf7cd..3025a641ec9 100644 --- a/standalone-container/src/test/java/com/yahoo/container/standalone/StandaloneSubscriberTest.java +++ b/standalone-container/src/test/java/com/yahoo/container/standalone/StandaloneSubscriberTest.java @@ -15,9 +15,8 @@ import java.util.Map; import java.util.Set; import static com.yahoo.container.standalone.StandaloneContainer.withContainerModel; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.number.OrderingComparison.greaterThan; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * @author Tony Vaagenes @@ -42,15 +41,15 @@ public class StandaloneSubscriberTest { keys.add(componentsKey); Subscriber subscriber = new StandaloneSubscriberFactory(root).getSubscriber(keys); Map<ConfigKey<ConfigInstance>, ConfigInstance> config = subscriber.config(); - assertThat(config.size(), is(2)); + assertEquals(2, config.size()); PlatformBundlesConfig platformBundlesConfig = (PlatformBundlesConfig) config.get(platformBundlesKey); ApplicationBundlesConfig applicationBundlesConfig = (ApplicationBundlesConfig) config.get(applicationBundlesKey); ComponentsConfig componentsConfig = (ComponentsConfig) config.get(componentsKey); - assertThat(platformBundlesConfig.bundlePaths().size(), is(0)); - assertThat(applicationBundlesConfig.bundles().size(), is(0)); - assertThat(componentsConfig.components().size(), greaterThan(10)); + assertEquals(0, platformBundlesConfig.bundlePaths().size()); + assertEquals(0, applicationBundlesConfig.bundles().size()); + assertTrue(componentsConfig.components().size() > 10); return null; }); } |