XmlSourceEditorViewFactory implements ResponseEditorViewFactory, RequestEditorViewFactory { @SuppressWarnings("unchecked") public EditorView<?> createResponseEditorView(Editor<?> editor, ModelItem modelItem) { if (modelItem instanceof WsdlRequest) { return new WsdlResponseXmlSourceEditor((XmlEditor) editor, (WsdlRequest) modelItem); } else if (modelItem instanceof WsdlMockResponse) { return new WsdlMockResponseXmlSourceEditor((XmlEditor) editor, (WsdlMockResponse) modelItem); } else if (modelItem instanceof HttpRequestInterface<?>) { return new RestResponseXmlSourceEditor((XmlEditor) editor, (HttpRequestInterface<?>) modelItem); } else if (modelItem instanceof MessageExchangeModelItem) { return new XmlSourceEditorView<MessageExchangeModelItem>((XmlEditor) editor, (MessageExchangeModelItem) modelItem, true); } else if (modelItem instanceof JdbcRequestTestStep) { return new XmlSourceEditorView<JdbcRequestTestStep>((XmlEditor) editor, (JdbcRequestTestStep) modelItem, true); } else if (modelItem instanceof AMFRequestTestStep) { return new XmlSourceEditorView<AMFRequestTestStep>((XmlEditor) editor, (AMFRequestTestStep) modelItem, true); } else if (modelItem instanceof RestMockResponse) { boolean readOnly = false; return new XmlSourceEditorView((XmlEditor) editor, modelItem, readOnly, "Editor"); } return null; }  @SuppressWarnings("unchecked") XmlEditorView createEditorView(XmlEditor editor); String getViewId(); @SuppressWarnings("unchecked") EditorView<?> createRequestEditorView(Editor<?> editor, ModelItem modelItem); @SuppressWarnings("unchecked") EditorView<?> createResponseEditorView(Editor<?> editor, ModelItem modelItem); static final String VIEW_ID; }
@Test public void testCreateResponseEditorViewForWsdlMockResponse() throws Exception { mockResponse = mock(WsdlMockResponse.class); EditorView<?> requestEditorView = xmlSourceEditorViewFactory.createResponseEditorView(editor, mockResponse); assertEditorView(requestEditorView); }
@Test public void testCreateResponseEditorViewForRestMockResponse() throws Exception { mockResponse = mock(RestMockResponse.class); EditorView<?> responseEditorView = xmlSourceEditorViewFactory.createResponseEditorView(editor, mockResponse); assertEditorView(responseEditorView, "Editor"); }