// Path: idobata4j-core/src/main/java/com/uphyca/idobata/event/MemberStatusChangedEvent.java
// public interface MemberStatusChangedEvent extends Serializable {
//     long getId();
// 
//     String getStatus();
// 
//     String getType();
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/event/MessageCreatedEvent.java
// public interface MessageCreatedEvent extends Serializable {
//     long getId();
// 
//     String getBody();
// 
//     String getBodyPlain();
// 
//     List<String> getImageUrls();
// 
//     boolean isMultiline();
// 
//     List<Long> getMentions();
// 
//     String getCreatedAt();
// 
//     long getRoomId();
// 
//     String getRoomName();
// 
//     String getOrganizationSlug();
// 
//     String getSenderType();
// 
//     long getSenderId();
// 
//     String getSenderName();
// 
//     String getSenderIconUrl();
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/event/RoomTouchedEvent.java
// public interface RoomTouchedEvent extends Serializable {
// 
//     long getRoomId();
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/transform/Converter.java
// public interface Converter {
// 
//     /**
//      * Convert an HTTP response body to a concrete object of the specified type.
//      * 
//      * @param body HTTP response body.
//      * @param type Target object type.
//      * @return Instance of {@code type} which will be cast by the caller.
//      * @throws Exception
//      */
//     <T> T convert(TypedInput body, Type type) throws ConversionException, IOException;
// }


import com.pusher.client.Pusher;
import com.pusher.client.channel.PresenceChannel;
import com.pusher.client.channel.PresenceChannelEventListener;
import com.uphyca.idobata.event.MemberStatusChangedEvent;
import com.uphyca.idobata.event.MessageCreatedEvent;
import com.uphyca.idobata.event.RoomTouchedEvent;
import com.uphyca.idobata.transform.Converter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import static org.mockito.BDDMockito.*;
    @Test
    public void subscribeMessageCreated() throws Exception {
        final String eventName = "message_created";

        IdobataStream.Listener<MessageCreatedEvent> listener = mock(IdobataStream.Listener.class);
        underTest.subscribeMessageCreated(listener);

        underTest.onEvent(channelName, eventName, "{}");

        verify(presenceChannel).bind(eq(eventName), any(PresenceChannelEventListener.class));
        verify(listener).onEvent(any(MessageCreatedEvent.class));
    }

    @Test
    public void subscribeMemberStatusChanged() throws Exception {
        final String eventName = "member_status_changed";

        IdobataStream.Listener<MemberStatusChangedEvent> listener = mock(IdobataStream.Listener.class);
        underTest.subscribeMemberStatusChanged(listener);

        underTest.onEvent(channelName, eventName, "{}");

        verify(presenceChannel).bind(eq(eventName), any(PresenceChannelEventListener.class));
        verify(listener).onEvent(any(MemberStatusChangedEvent.class));
    }

    @Test
    public void subscribeRoomTouched() throws Exception {
        final String eventName = "room_touched";

// Path: idobata4j-core/src/main/java/com/uphyca/idobata/event/MemberStatusChangedEvent.java
// public interface MemberStatusChangedEvent extends Serializable {
//     long getId();
// 
//     String getStatus();
// 
//     String getType();
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/event/MessageCreatedEvent.java
// public interface MessageCreatedEvent extends Serializable {
//     long getId();
// 
//     String getBody();
// 
//     String getBodyPlain();
// 
//     List<String> getImageUrls();
// 
//     boolean isMultiline();
// 
//     List<Long> getMentions();
// 
//     String getCreatedAt();
// 
//     long getRoomId();
// 
//     String getRoomName();
// 
//     String getOrganizationSlug();
// 
//     String getSenderType();
// 
//     long getSenderId();
// 
//     String getSenderName();
// 
//     String getSenderIconUrl();
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/event/RoomTouchedEvent.java
// public interface RoomTouchedEvent extends Serializable {
// 
//     long getRoomId();
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/transform/Converter.java
// public interface Converter {
// 
//     /**
//      * Convert an HTTP response body to a concrete object of the specified type.
//      * 
//      * @param body HTTP response body.
//      * @param type Target object type.
//      * @return Instance of {@code type} which will be cast by the caller.
//      * @throws Exception
//      */
//     <T> T convert(TypedInput body, Type type) throws ConversionException, IOException;
// }


// Path: idobata4j-core/src/test/java/com/uphyca/idobata/IdobataStreamTest.java
import com.pusher.client.Pusher;
import com.pusher.client.channel.PresenceChannel;
import com.pusher.client.channel.PresenceChannelEventListener;
import com.uphyca.idobata.event.MemberStatusChangedEvent;
import com.uphyca.idobata.event.MessageCreatedEvent;
import com.uphyca.idobata.event.RoomTouchedEvent;
import com.uphyca.idobata.transform.Converter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import static org.mockito.BDDMockito.*;

    @Test
    public void subscribeMessageCreated() throws Exception {
        final String eventName = "message_created";

        IdobataStream.Listener<MessageCreatedEvent> listener = mock(IdobataStream.Listener.class);
        underTest.subscribeMessageCreated(listener);

        underTest.onEvent(channelName, eventName, "{}");

        verify(presenceChannel).bind(eq(eventName), any(PresenceChannelEventListener.class));
        verify(listener).onEvent(any(MessageCreatedEvent.class));
    }

    @Test
    public void subscribeMemberStatusChanged() throws Exception {
        final String eventName = "member_status_changed";

        IdobataStream.Listener<MemberStatusChangedEvent> listener = mock(IdobataStream.Listener.class);
        underTest.subscribeMemberStatusChanged(listener);

        underTest.onEvent(channelName, eventName, "{}");

        verify(presenceChannel).bind(eq(eventName), any(PresenceChannelEventListener.class));
        verify(listener).onEvent(any(MemberStatusChangedEvent.class));
    }

    @Test
    public void subscribeRoomTouched() throws Exception {
        final String eventName = "room_touched";

        IdobataStream.Listener<RoomTouchedEvent> listener = mock(IdobataStream.Listener.class);