ResponseDescriptorFactory { public ResponseDescriptor createResponseDescriptorForStubMode() { Template template = new Template("template-for-stub-mode", TemplateType.TEXT, DEFAULT_ERROR_MESSAGE.getBytes()); ResponseDescriptorAttributes responseAttributes = new ResponseDescriptorAttributes.Builder().delay(0).code("404") .mimeType(MimeType.TEXT.getOfficialMimeType()).template(template).build(); ResponseDescriptor responseDescriptor = new ResponseDescriptor(responseAttributes, null); return responseDescriptor; }  ResponseDescriptor createResponseDescriptorForStubMode();  }
@Test public void testCreateResponseDescriptorForStubMode() { String expectedMessage = "The requested URL was not found on this WILMA server."; Template expectedTemplate = new Template("template-for-stub-mode", TemplateType.TEXT, expectedMessage.getBytes()); ResponseDescriptor responseDescriptor = underTest.createResponseDescriptorForStubMode(); ResponseDescriptorAttributes actualAttributes = responseDescriptor.getAttributes(); assertEquals(0, actualAttributes.getDelay()); assertEquals("404", actualAttributes.getCode()); assertEquals(MimeType.TEXT.getOfficialMimeType(), actualAttributes.getMimeType()); assertEquals(expectedTemplate, actualAttributes.getTemplate()); assertNull(responseDescriptor.getResponseFormatters()); }