コード例 #1
0
 private Channel getMockedChannel() {
   Channel channel = mock(Channel.class);
   Server server = mock(Server.class);
   when(channel.getName()).thenReturn("#test");
   when(channel.getServer()).thenReturn(server);
   when(server.getURI()).thenReturn("irc://irc.example.com");
   return channel;
 }
コード例 #2
0
 @GET
 @Produces(MediaType.APPLICATION_JSON)
 public ChannelMessageRepresentation getMessage(
     @PathParam("server") String serverID,
     @PathParam("channel") String channelID,
     @PathParam("message") long messageID) {
   final Server server = serverManager.getServer(serverID);
   final Channel channel = server.getChannel(channelID);
   final ChannelMessage message = channel.getMessage(messageID);
   final ChannelMessageRepresentation rep = new ChannelMessageRepresentation();
   rep.setChannelMessage(message);
   return rep;
 }