XmlSourceEditorViewFactory implements ResponseEditorViewFactory, RequestEditorViewFactory { @SuppressWarnings("unchecked") public EditorView<?> createRequestEditorView(Editor<?> editor, ModelItem modelItem) { if (modelItem instanceof WsdlRequest) { return new WsdlRequestXmlSourceEditor((XmlEditor) editor, (WsdlRequest) modelItem); } else if (modelItem instanceof WsdlMockResponse) { return new WsdlMockRequestXmlSourceEditor((XmlEditor) editor, (WsdlMockResponse) modelItem); } else if (modelItem instanceof MessageExchangeModelItem) { return new XmlSourceEditorView<MessageExchangeModelItem>((XmlEditor) editor, (MessageExchangeModelItem) modelItem, false); } else if (modelItem instanceof RestMockResponse) { boolean readOnly = false; return new XmlSourceEditorView((XmlEditor) editor, modelItem, readOnly); } 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 testCreateRequestEditorViewForWsdlMockResponse() throws Exception { mockResponse = mock(WsdlMockResponse.class); EditorView<?> requestEditorView = xmlSourceEditorViewFactory.createRequestEditorView(editor, mockResponse); assertEditorView(requestEditorView); }
@Test public void testCreateRequestEditorViewForRestMockResponse() throws Exception { mockResponse = mock(RestMockResponse.class); EditorView<?> requestEditorView = xmlSourceEditorViewFactory.createRequestEditorView(editor, mockResponse); assertEditorView(requestEditorView); }