summaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java
Publish
Diffstat (limited to 'jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java')
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java
new file mode 100644
index 00000000000..1154d01dfe5
--- /dev/null
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java
@@ -0,0 +1,38 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.jdisc.core;
+
+import com.google.inject.Guice;
+import com.yahoo.jdisc.application.BindingSet;
+import com.yahoo.jdisc.application.BindingSetSelector;
+import org.junit.Test;
+
+import java.net.URI;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
+ */
+public class DefaultBindingSelectorTestCase {
+
+ @Test
+ public void requireThatClassIsInjectedByDefault() {
+ BindingSetSelector selector = Guice.createInjector().getInstance(BindingSetSelector.class);
+ assertTrue(selector instanceof DefaultBindingSelector);
+ }
+
+ @Test
+ public void requireThatDefaultSetIsAlwaysSelected() {
+ DefaultBindingSelector selector = new DefaultBindingSelector();
+ assertEquals(BindingSet.DEFAULT, selector.select(null));
+ for (int i = 0; i < 69; ++i) {
+ assertEquals(BindingSet.DEFAULT, selector.select(newUri()));
+ }
+ }
+
+ private static URI newUri() {
+ return URI.create("foo" + System.nanoTime() + "://bar" + System.nanoTime() + "/baz" + System.nanoTime());
+ }
+}