@Test(expected = MgcpParseException.class) public void testParseMalformedRequest() throws Exception { final int requestId = 16; final String requestedEvents = "AU/oc(XYZ"; final MgcpPackage mgcpPackage = mock(MgcpPackage.class); final MgcpEventType eventType = mock(MgcpEventType.class); final MgcpPackageManager packageManager = mock(MgcpPackageManager.class); when(packageManager.getPackage("AU")).thenReturn(mgcpPackage); when(mgcpPackage.getEventDetails(any(String.class))).thenReturn(eventType); when(eventType.parameterized()).thenReturn(false); MgcpRequestedEventsParser.parse(requestId, requestedEvents, packageManager); }
public static MgcpRequestedEvent[] parse(int requestId, String requestedEvents, MgcpPackageManager packageManager) throws UnrecognizedMgcpPackageException, UnrecognizedMgcpEventException, UnrecognizedMgcpActionException, MgcpParseException { String[] tokens = requestedEvents.split("(?<=\\)),"); MgcpRequestedEvent[] events = new MgcpRequestedEvent[tokens.length]; for (int i = 0; i < events.length; i++) { events[i] = parseSingle(requestId, tokens[i], packageManager); } return events; }
MgcpRequestedEventsParser { public static MgcpRequestedEvent[] parse(int requestId, String requestedEvents, MgcpPackageManager packageManager) throws UnrecognizedMgcpPackageException, UnrecognizedMgcpEventException, UnrecognizedMgcpActionException, MgcpParseException { String[] tokens = requestedEvents.split("(?<=\\)),"); MgcpRequestedEvent[] events = new MgcpRequestedEvent[tokens.length]; for (int i = 0; i < events.length; i++) { events[i] = parseSingle(requestId, tokens[i], packageManager); } return events; } }
MgcpRequestedEventsParser { public static MgcpRequestedEvent[] parse(int requestId, String requestedEvents, MgcpPackageManager packageManager) throws UnrecognizedMgcpPackageException, UnrecognizedMgcpEventException, UnrecognizedMgcpActionException, MgcpParseException { String[] tokens = requestedEvents.split("(?<=\\)),"); MgcpRequestedEvent[] events = new MgcpRequestedEvent[tokens.length]; for (int i = 0; i < events.length; i++) { events[i] = parseSingle(requestId, tokens[i], packageManager); } return events; }  }
MgcpRequestedEventsParser { public static MgcpRequestedEvent[] parse(int requestId, String requestedEvents, MgcpPackageManager packageManager) throws UnrecognizedMgcpPackageException, UnrecognizedMgcpEventException, UnrecognizedMgcpActionException, MgcpParseException { String[] tokens = requestedEvents.split("(?<=\\)),"); MgcpRequestedEvent[] events = new MgcpRequestedEvent[tokens.length]; for (int i = 0; i < events.length; i++) { events[i] = parseSingle(requestId, tokens[i], packageManager); } return events; }  static MgcpRequestedEvent[] parse(int requestId, String requestedEvents, MgcpPackageManager packageManager); }
MgcpRequestedEventsParser { public static MgcpRequestedEvent[] parse(int requestId, String requestedEvents, MgcpPackageManager packageManager) throws UnrecognizedMgcpPackageException, UnrecognizedMgcpEventException, UnrecognizedMgcpActionException, MgcpParseException { String[] tokens = requestedEvents.split("(?<=\\)),"); MgcpRequestedEvent[] events = new MgcpRequestedEvent[tokens.length]; for (int i = 0; i < events.length; i++) { events[i] = parseSingle(requestId, tokens[i], packageManager); } return events; }  static MgcpRequestedEvent[] parse(int requestId, String requestedEvents, MgcpPackageManager packageManager);  }