// 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.*;
/*
 * Copyright (C) 2014 uPhyca Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.uphyca.idobata;



/**
 * @author Sosuke Masui (masui@uphyca.com)
 */
@RunWith(MockitoJUnitRunner.class)
public class IdobataStreamTest {

    IdobataStreamImpl underTest;

    @Mock
    Idobata idobata;

    @Mock
    Pusher pusher;

    @Mock
    PresenceChannel presenceChannel;

    String channelName;

    @Mock
    Converter converter;

    @Before
    public void setUp() throws Exception {
        channelName = "abc";
        given(pusher.subscribePresence(channelName)).willReturn(presenceChannel);

        underTest = new IdobataStreamImpl(idobata, pusher, channelName, converter);
    }

    @Test
    public void close() throws Exception {
        underTest.close();

// 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.*;

/*
 * Copyright (C) 2014 uPhyca Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.uphyca.idobata;



/**
 * @author Sosuke Masui (masui@uphyca.com)
 */
@RunWith(MockitoJUnitRunner.class)
public class IdobataStreamTest {

    IdobataStreamImpl underTest;

    @Mock
    Idobata idobata;

    @Mock
    Pusher pusher;

    @Mock
    PresenceChannel presenceChannel;

    String channelName;

    @Mock
    Converter converter;

    @Before
    public void setUp() throws Exception {
        channelName = "abc";
        given(pusher.subscribePresence(channelName)).willReturn(presenceChannel);

        underTest = new IdobataStreamImpl(idobata, pusher, channelName, converter);
    }

    @Test
    public void close() throws Exception {
        underTest.close();

        verify(pusher).disconnect();