aboutsummaryrefslogtreecommitdiffstats
path: root/container-messagebus/src/test/java/com/yahoo/messagebus/jdisc/MbusResponseTestCase.java
blob: 9468f22adba6297a12f764f88ee0edd468f98704 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright Yahoo. 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;
        }
    }
}