summaryrefslogtreecommitdiffstats
path: root/container-messagebus/src/test/java/com/yahoo/messagebus/jdisc/MbusResponseTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-messagebus/src/test/java/com/yahoo/messagebus/jdisc/MbusResponseTestCase.java')
-rw-r--r--container-messagebus/src/test/java/com/yahoo/messagebus/jdisc/MbusResponseTestCase.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/container-messagebus/src/test/java/com/yahoo/messagebus/jdisc/MbusResponseTestCase.java b/container-messagebus/src/test/java/com/yahoo/messagebus/jdisc/MbusResponseTestCase.java
new file mode 100644
index 00000000000..eb4cb949770
--- /dev/null
+++ b/container-messagebus/src/test/java/com/yahoo/messagebus/jdisc/MbusResponseTestCase.java
@@ -0,0 +1,46 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.messagebus.jdisc;
+
+import com.yahoo.jdisc.Response;
+import com.yahoo.messagebus.Reply;
+import com.yahoo.text.Utf8String;
+import org.junit.Test;
+
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
+/**
+ * @author Simon Thoresen Hult
+ */
+public class MbusResponseTestCase {
+
+ @Test
+ public void requireThatAccessorsWork() {
+ MyReply reply = new MyReply();
+ MbusResponse response = new MbusResponse(Response.Status.OK, reply);
+ assertSame(reply, response.getReply());
+ }
+
+ @Test
+ public void requireThatReplyCanNotBeNull() {
+ try {
+ new MbusResponse(Response.Status.OK, null);
+ fail();
+ } catch (NullPointerException e) {
+
+ }
+ }
+
+ private class MyReply extends Reply {
+
+ @Override
+ public Utf8String getProtocol() {
+ return null;
+ }
+
+ @Override
+ public int getType() {
+ return 0;
+ }
+ }
+}