当前位置: 首页>>代码示例>>Java>>正文


Java GroupSource类代码示例

本文整理汇总了Java中com.linecorp.bot.model.event.source.GroupSource的典型用法代码示例。如果您正苦于以下问题:Java GroupSource类的具体用法?Java GroupSource怎么用?Java GroupSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GroupSource类属于com.linecorp.bot.model.event.source包,在下文中一共展示了GroupSource类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: textTextGroup

import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
@Test
public void textTextGroup() throws IOException {
    parse("callback/text-group.json", callbackRequest -> {
        assertThat(callbackRequest.getEvents()).hasSize(1);
        Event event = callbackRequest.getEvents().get(0);
        assertThat(event).isInstanceOf(MessageEvent.class);
        assertThat(event.getSource())
                .isInstanceOf(GroupSource.class);
        assertThat(event.getSource().getUserId())
                .isNull();

        MessageEvent messageEvent = (MessageEvent) event;
        assertThat(messageEvent.getReplyToken())
                .isEqualTo("nHuyWiB7yP5Zw52FIkcQobQuGDXCTA");
        MessageContent message = messageEvent.getMessage();
        assertThat(message).isInstanceOf(TextMessageContent.class);
    });
}
 
开发者ID:line,项目名称:line-bot-sdk-java,代码行数:19,代码来源:CallbackRequestTest.java

示例2: getId

import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
public String getId(Source source){
    String id=null;
    String type=null;
    if (source instanceof GroupSource) {
        id = ((GroupSource) source).getGroupId();
        type="group";
    } else if (source instanceof RoomSource) {
        id = ((RoomSource) source).getRoomId();
        type="room";
    } else{
        id = source.getUserId();
        type="personal";
    }
    return id;
}
 
开发者ID:axellageraldinc,项目名称:lj-line-bot,代码行数:16,代码来源:Getter.java

示例3: getType

import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
public String getType(Source source){
    String type = null;
    if (source instanceof GroupSource)
        type="group";
    else if(source instanceof RoomSource)
        type="room";
    else
        type="personal";
    return type;
}
 
开发者ID:axellageraldinc,项目名称:lj-line-bot,代码行数:11,代码来源:Getter.java

示例4: testJoin

import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
@Test
public void testJoin() throws IOException {
    parse("callback/join.json", callbackRequest -> {
        assertThat(callbackRequest.getEvents()).hasSize(1);
        Event event = callbackRequest.getEvents().get(0);
        assertThat(event).isInstanceOf(JoinEvent.class);
        assertThat(event.getSource())
                .isInstanceOf(GroupSource.class);
        assertThat(((GroupSource) event.getSource()).getGroupId())
                .isEqualTo("cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        assertThat(event.getTimestamp())
                .isEqualTo(Instant.parse("2016-05-07T13:57:59.859Z"));
    });
}
 
开发者ID:line,项目名称:line-bot-sdk-java,代码行数:15,代码来源:CallbackRequestTest.java

示例5: testLeave

import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
@Test
public void testLeave() throws IOException {
    parse("callback/leave.json", callbackRequest -> {
        assertThat(callbackRequest.getEvents()).hasSize(1);
        Event event = callbackRequest.getEvents().get(0);
        assertThat(event).isInstanceOf(LeaveEvent.class);
        assertThat(event.getSource())
                .isInstanceOf(GroupSource.class);
        assertThat(((GroupSource) event.getSource()).getGroupId())
                .isEqualTo("cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        assertThat(event.getTimestamp())
                .isEqualTo(Instant.parse("2016-05-07T13:57:59.859Z"));
    });
}
 
开发者ID:line,项目名称:line-bot-sdk-java,代码行数:15,代码来源:CallbackRequestTest.java


注:本文中的com.linecorp.bot.model.event.source.GroupSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。