public static void compare(final InputStream input, final InputStream expected, final ResourcePostProcessor processor) throws IOException { compare(new InputStreamReader(input), new InputStreamReader(expected), processor); }
public static void compare(final InputStream input, final InputStream expected, final ResourcePostProcessor processor) throws IOException { compare(new InputStreamReader(input), new InputStreamReader(expected), processor); }
/** * Compare contents of two resources (files) by performing some sort of processing on input resource. * * @param inputResourceUri * uri of the resource to process. * @param expectedContentResourceUri * uri of the resource to compare with processed content. * @param processor * a closure used to process somehow the input content. */ public static void compare(final Reader resultReader, final Reader expectedReader, final ResourcePostProcessor processor) throws IOException { final Writer resultWriter = new StringWriter(); processor.process(resultReader, resultWriter); final Writer expectedWriter = new StringWriter(); IOUtils.copy(expectedReader, expectedWriter); compare(expectedWriter.toString(), resultWriter.toString()); expectedReader.close(); expectedWriter.close(); }
/** * Compare contents of two resources (files) by performing some sort of processing on input resource. * * @param inputResourceUri * uri of the resource to process. * @param expectedContentResourceUri * uri of the resource to compare with processed content. * @param processor * a closure used to process somehow the input content. */ public static void compare(final Reader resultReader, final Reader expectedReader, final ResourcePostProcessor processor) throws IOException { final Writer resultWriter = new StringWriter(); processor.process(resultReader, resultWriter); final Writer expectedWriter = new StringWriter(); IOUtils.copy(expectedReader, expectedWriter); compare(expectedWriter.toString(), resultWriter.toString()); expectedReader.close(); expectedWriter.close(); }
LOG.debug("comparing with: {}", targetFile.getName()); try { compare(new FileInputStream(file), targetFileStream, new ResourcePostProcessor() { public void process(final Reader reader, final Writer writer) throws IOException {
/** * Compare contents of two resources (files) by performing some sort of processing on input resource. * * @param inputResourceUri * uri of the resource to process. * @param expectedContentResourceUri * uri of the resource to compare with processed content. * @param processor * a closure used to process somehow the input content. */ public static void compareProcessedResourceContents(final String inputResourceUri, final String expectedContentResourceUri, final ResourcePostProcessor processor) throws IOException { final Reader resultReader = getReaderFromUri(inputResourceUri); final Reader expectedReader = getReaderFromUri(expectedContentResourceUri); compare(resultReader, expectedReader, processor); }
/** * Compare contents of two resources (files) by performing some sort of processing on input resource. * * @param inputResourceUri * uri of the resource to process. * @param expectedContentResourceUri * uri of the resource to compare with processed content. * @param processor * a closure used to process somehow the input content. */ public static void compareProcessedResourceContents(final String inputResourceUri, final String expectedContentResourceUri, final ResourcePostProcessor processor) throws IOException { final Reader resultReader = getReaderFromUri(inputResourceUri); final Reader expectedReader = getReaderFromUri(expectedContentResourceUri); compare(resultReader, expectedReader, processor); }
LOG.debug("comparing with: {}", targetFile.getName()); try { compare(sourceFileStream = new FileInputStream(file), targetFileStream, new ResourcePostProcessor() { public void process(final Reader reader, final Writer writer) throws IOException {
/** * Compare if content of expected stream is the same as content of the actual stream. When compared content is not * equal, the assertion error will be thrown. * * @param expected * {@link InputStream} of the expected content. * @param actual * {@link InputStream} of the actual content. */ public static void compare(final InputStream expected, final InputStream actual) throws IOException { Assert.assertNotNull(expected); Assert.assertNotNull(actual); final String encoding = Context.get().getConfig().getEncoding(); compare(IOUtils.toString(expected, encoding), IOUtils.toString(actual, encoding)); expected.close(); actual.close(); }
compare(new FileInputStream(file), targetFileStream, new ResourcePostProcessor() { public void process(final Reader reader, final Writer writer) throws IOException {
/** * Compare if content of expected stream is the same as content of the actual stream. When compared content is not * equal, the assertion error will be thrown. * * @param expected * {@link InputStream} of the expected content. * @param actual * {@link InputStream} of the actual content. */ public static void compare(final InputStream expected, final InputStream actual) throws IOException { Assert.assertNotNull(expected); Assert.assertNotNull(actual); final String encoding = Context.get().getConfig().getEncoding(); compare(IOUtils.toString(expected, encoding), IOUtils.toString(actual, encoding)); expected.close(); actual.close(); }
compare(new AutoCloseInputStream(new FileInputStream(file)), targetFileStream, new ResourcePostProcessor() { public void process(final Reader reader, final Writer writer) throws IOException {