WorkflowTraceUtil { public static AbstractRecord getLastReceivedRecord(WorkflowTrace trace) { List<AbstractRecord> recordList = getAllReceivedRecords(trace); if (recordList.isEmpty()) { return null; } else { return recordList.get(recordList.size() - 1); } } private  WorkflowTraceUtil(); static ProtocolMessage getFirstReceivedMessage(ProtocolMessageType type, WorkflowTrace trace); static HandshakeMessage getFirstReceivedMessage(HandshakeMessageType type, WorkflowTrace trace); static HandshakeMessage getLastReceivedMessage(HandshakeMessageType type, WorkflowTrace trace); static ProtocolMessage getLastReceivedMessage(ProtocolMessageType type, WorkflowTrace trace); static AbstractRecord getLastReceivedRecord(WorkflowTrace trace); static ProtocolMessage getFirstSendMessage(ProtocolMessageType type, WorkflowTrace trace); static ExtensionMessage getFirstSendExtension(ExtensionType type, WorkflowTrace trace); static List<HandshakeMessage> getAllSendHandshakeMessages(WorkflowTrace trace); static List<HandshakeMessage> getAllReceivedHandshakeMessages(WorkflowTrace trace); static List<ExtensionMessage> getAllSendExtensions(WorkflowTrace trace); static List<ExtensionMessage> getAllReceivedExtensions(WorkflowTrace trace); static HandshakeMessage getFirstSendMessage(HandshakeMessageType type, WorkflowTrace trace); static HandshakeMessage getLastSendMessage(HandshakeMessageType type, WorkflowTrace trace); static ProtocolMessage getLastSendMessage(ProtocolMessageType type, WorkflowTrace trace); static boolean didReceiveMessage(ProtocolMessageType type, WorkflowTrace trace); static boolean didReceiveMessage(HandshakeMessageType type, WorkflowTrace trace); static boolean didSendMessage(ProtocolMessageType type, WorkflowTrace trace); static boolean didSendMessage(HandshakeMessageType type, WorkflowTrace trace); static ProtocolMessage getLastReceivedMessage(WorkflowTrace trace); static List<HandshakeMessage> filterHandshakeMessagesFromList(List<ProtocolMessage> messages); static List<ProtocolMessage> getAllReceivedMessages(WorkflowTrace trace); static List<ProtocolMessage> getAllReceivedMessages(WorkflowTrace trace, ProtocolMessageType type); static List<ProtocolMessage> getAllSendMessages(WorkflowTrace trace); static Boolean didReceiveTypeBeforeType(ProtocolMessageType protocolMessageType, HandshakeMessageType type,
            WorkflowTrace trace); static List<AbstractRecord> getAllReceivedRecords(WorkflowTrace trace); static List<AbstractRecord> getAllSendRecords(WorkflowTrace trace); static SendingAction getLastSendingAction(WorkflowTrace trace);  }
@Test public void testGetLastReceivedRecord() { assertNull(WorkflowTraceUtil.getLastReceivedRecord(trace)); trace.addTlsAction(rcvMultipleRecords); assertNotSame(rcvMultipleRecords.getRecords().get(0), WorkflowTraceUtil.getLastReceivedRecord(trace)); assertNotSame(rcvMultipleRecords.getRecords().get(1), WorkflowTraceUtil.getLastReceivedRecord(trace)); assertSame(rcvMultipleRecords.getRecords().get(2), WorkflowTraceUtil.getLastReceivedRecord(trace)); }