@Test public void testCreateStubSimpleMockFromXmlFile() throws StubConfigurationException { wilmaStub = new WilmaStubBuilder() .forRequestsLike().textInUrl("/blah") .willRespondWith().xmlFileResponse("filename").withStatus(200) .build(); Assert.assertTrue(wilmaStub.toString().contains("application/xml"), "Bad mime type was set."); Assert.assertTrue(!wilmaStub.toString().contains("interceptor"), "Should not contain any interceptor related entry."); }
@Override public String toString() { String generatedName = "generated name"; String conditionContent = ""; if (requestCondition != null) { conditionContent = requestCondition.toString(); } String responseContent = ""; String usedTemplate = ""; if (responseDescriptor != null) { responseContent = responseDescriptor.responseDescriptorToString(); usedTemplate = responseDescriptor.templateToString(); } String stubConfigurationFormatterString = "{ \"wilmaStubConfiguration\": { \n" + " \"groupName\": \"" + groupName + "\""; if (responseDescriptor != null) { stubConfigurationFormatterString += ",\n \"dialogDescriptors\": [{ \"name\": \"" + generatedName + "\"," + " \"usage\": \"always\", \"comment\": \"" + generatedName + "\"," + "\n \"conditionDescriptor\": " + conditionContent + ",\n \"responseDescriptor\": " + responseContent + "}]," + "\n \"templates\": [ " + usedTemplate + " ]"; } if (interceptorDescriptor != null) { stubConfigurationFormatterString += ",\n " + interceptorDescriptor.toString(); } stubConfigurationFormatterString += "\n }\n}"; return stubConfigurationFormatterString; }
WilmaStub { @Override public String toString() { String generatedName = "generated name"; String conditionContent = ""; if (requestCondition != null) { conditionContent = requestCondition.toString(); } String responseContent = ""; String usedTemplate = ""; if (responseDescriptor != null) { responseContent = responseDescriptor.responseDescriptorToString(); usedTemplate = responseDescriptor.templateToString(); } String stubConfigurationFormatterString = "{ \"wilmaStubConfiguration\": { \n" + " \"groupName\": \"" + groupName + "\""; if (responseDescriptor != null) { stubConfigurationFormatterString += ",\n \"dialogDescriptors\": [{ \"name\": \"" + generatedName + "\"," + " \"usage\": \"always\", \"comment\": \"" + generatedName + "\"," + "\n \"conditionDescriptor\": " + conditionContent + ",\n \"responseDescriptor\": " + responseContent + "}]," + "\n \"templates\": [ " + usedTemplate + " ]"; } if (interceptorDescriptor != null) { stubConfigurationFormatterString += ",\n " + interceptorDescriptor.toString(); } stubConfigurationFormatterString += "\n }\n}"; return stubConfigurationFormatterString; } }
WilmaStub { @Override public String toString() { String generatedName = "generated name"; String conditionContent = ""; if (requestCondition != null) { conditionContent = requestCondition.toString(); } String responseContent = ""; String usedTemplate = ""; if (responseDescriptor != null) { responseContent = responseDescriptor.responseDescriptorToString(); usedTemplate = responseDescriptor.templateToString(); } String stubConfigurationFormatterString = "{ \"wilmaStubConfiguration\": { \n" + " \"groupName\": \"" + groupName + "\""; if (responseDescriptor != null) { stubConfigurationFormatterString += ",\n \"dialogDescriptors\": [{ \"name\": \"" + generatedName + "\"," + " \"usage\": \"always\", \"comment\": \"" + generatedName + "\"," + "\n \"conditionDescriptor\": " + conditionContent + ",\n \"responseDescriptor\": " + responseContent + "}]," + "\n \"templates\": [ " + usedTemplate + " ]"; } if (interceptorDescriptor != null) { stubConfigurationFormatterString += ",\n " + interceptorDescriptor.toString(); } stubConfigurationFormatterString += "\n }\n}"; return stubConfigurationFormatterString; } WilmaStub(String groupName, RequestCondition requestCondition, ResponseDescriptor responseDescriptor, InterceptorDescriptor interceptorDescriptor); }
WilmaStub { @Override public String toString() { String generatedName = "generated name"; String conditionContent = ""; if (requestCondition != null) { conditionContent = requestCondition.toString(); } String responseContent = ""; String usedTemplate = ""; if (responseDescriptor != null) { responseContent = responseDescriptor.responseDescriptorToString(); usedTemplate = responseDescriptor.templateToString(); } String stubConfigurationFormatterString = "{ \"wilmaStubConfiguration\": { \n" + " \"groupName\": \"" + groupName + "\""; if (responseDescriptor != null) { stubConfigurationFormatterString += ",\n \"dialogDescriptors\": [{ \"name\": \"" + generatedName + "\"," + " \"usage\": \"always\", \"comment\": \"" + generatedName + "\"," + "\n \"conditionDescriptor\": " + conditionContent + ",\n \"responseDescriptor\": " + responseContent + "}]," + "\n \"templates\": [ " + usedTemplate + " ]"; } if (interceptorDescriptor != null) { stubConfigurationFormatterString += ",\n " + interceptorDescriptor.toString(); } stubConfigurationFormatterString += "\n }\n}"; return stubConfigurationFormatterString; } WilmaStub(String groupName, RequestCondition requestCondition, ResponseDescriptor responseDescriptor, InterceptorDescriptor interceptorDescriptor); @Override String toString(); void validateConfiguration(); String getGroupName(); }
WilmaStub { @Override public String toString() { String generatedName = "generated name"; String conditionContent = ""; if (requestCondition != null) { conditionContent = requestCondition.toString(); } String responseContent = ""; String usedTemplate = ""; if (responseDescriptor != null) { responseContent = responseDescriptor.responseDescriptorToString(); usedTemplate = responseDescriptor.templateToString(); } String stubConfigurationFormatterString = "{ \"wilmaStubConfiguration\": { \n" + " \"groupName\": \"" + groupName + "\""; if (responseDescriptor != null) { stubConfigurationFormatterString += ",\n \"dialogDescriptors\": [{ \"name\": \"" + generatedName + "\"," + " \"usage\": \"always\", \"comment\": \"" + generatedName + "\"," + "\n \"conditionDescriptor\": " + conditionContent + ",\n \"responseDescriptor\": " + responseContent + "}]," + "\n \"templates\": [ " + usedTemplate + " ]"; } if (interceptorDescriptor != null) { stubConfigurationFormatterString += ",\n " + interceptorDescriptor.toString(); } stubConfigurationFormatterString += "\n }\n}"; return stubConfigurationFormatterString; } WilmaStub(String groupName, RequestCondition requestCondition, ResponseDescriptor responseDescriptor, InterceptorDescriptor interceptorDescriptor); @Override String toString(); void validateConfiguration(); String getGroupName();  }