* Test of segment method, of class ThresholdSegmentation.
*/
@Test
public void testSegment_byTimeAndParticipant() {
System.out.println("segment_byTimeAndParticipant");
MessageSet messages = new MessageSet();
long now = new Date().getTime();
long second = 1 * 1000;
long minute = 60 * 1000;
messages.add(new Message(0, new Date(now), "Alice", "it's"));
messages.add(new Message(1, new Date(now + second), "Bob", "cow"));
messages.add(new Message(2, new Date(now + 2 * second), "Bob", "time"));
messages.add(new Message(3, new Date(now + minute), "Bob", "noooooooo"));
messages.add(new Message(4, new Date(now + minute + second), "Bob", "once"));
messages.add(new Message(5, new Date(now + 2 * minute), "Alice", "upon"));
messages.add(new Message(6, new Date(now + 3 * minute), "Alice", "a"));
messages.add(new Message(7, new Date(now + 3 * minute + second), "Alice", "time"));
ThresholdSegmentation instance = new ThresholdSegmentation(30, true);
SegmentSet segments = instance.segment(messages);
//Expecting 5 segments
assertEquals(5, segments.size());
Segment seg0 = segments.get(0);
Segment seg1 = segments.get(1);
Segment seg2 = segments.get(2);
Segment seg3 = segments.get(3);
Segment seg4 = segments.get(4);
assertEquals(1, seg0.getMessages().size()); //Alice
assertEquals(1, seg1.getMessages().size()); //Alice
assertEquals(2, seg2.getMessages().size()); //Alice, Alice
assertEquals(2, seg3.getMessages().size()); //Bob, Bob
assertEquals(2, seg4.getMessages().size()); //Bob, Bob
assertEquals(messages.get(0), seg0.getMessages().get(0));
assertEquals(messages.get(5), seg1.getMessages().get(0));
assertEquals(messages.get(6), seg2.getMessages().get(0));
assertEquals(messages.get(1), seg3.getMessages().get(0));
assertEquals(messages.get(3), seg4.getMessages().get(0));
}