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; }
@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; }