diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
commit | 72231250ed81e10d66bfe70701e64fa5fe50f712 (patch) | |
tree | 2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /serviceview/src/test |
Publish
Diffstat (limited to 'serviceview/src/test')
-rw-r--r-- | serviceview/src/test/java/com/yahoo/vespa/serviceview/bindings/ServicePortTest.java | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/serviceview/src/test/java/com/yahoo/vespa/serviceview/bindings/ServicePortTest.java b/serviceview/src/test/java/com/yahoo/vespa/serviceview/bindings/ServicePortTest.java new file mode 100644 index 00000000000..6044d3dc498 --- /dev/null +++ b/serviceview/src/test/java/com/yahoo/vespa/serviceview/bindings/ServicePortTest.java @@ -0,0 +1,78 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.serviceview.bindings; + +import static org.junit.Assert.*; + +import org.junit.Test; + +/** + * Functional test of tag checking. + * + * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + */ +public class ServicePortTest { + + @Test + public final void testNullTags() { + ServicePort s = new ServicePort(); + s.tags = null; + assertFalse(s.hasTags("http")); + } + + @Test + public final void testEmptyTags() { + ServicePort s = new ServicePort(); + s.tags = ""; + assertFalse(s.hasTags("http")); + } + + @Test + public final void testSubsetInArgs() { + ServicePort s = new ServicePort(); + s.tags = "http state status"; + assertTrue(s.hasTags("http", "state")); + } + + @Test + public final void testSupersetInArgs() { + ServicePort s = new ServicePort(); + s.tags = "http"; + assertFalse(s.hasTags("http", "rpc")); + } + + @Test + public final void testIdenticalInArgs() { + ServicePort s = new ServicePort(); + s.tags = "http rpc"; + assertTrue(s.hasTags("http", "rpc")); + } + + @Test + public final void testDisjunctBetweenArgsAndTags() { + ServicePort s = new ServicePort(); + s.tags = "http state moo"; + assertFalse(s.hasTags("http", "state", "rpc")); + } + + @Test + public final void testTagNameStartsWithOther() { + ServicePort s = new ServicePort(); + s.tags = "http state moo"; + assertFalse(s.hasTags("htt")); + } + + @Test + public final void testTagNameEndsWithOther() { + ServicePort s = new ServicePort(); + s.tags = "http state moo"; + assertFalse(s.hasTags("tp")); + } + + @Test + public final void testTagNameIsSubstringofOther() { + ServicePort s = new ServicePort(); + s.tags = "http state moo"; + assertFalse(s.hasTags("tt")); + } + +} |