From 5f23cdbe72ce89a493ae9d587a3914e3a5823df3 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Wed, 2 May 2018 19:06:33 +0000 Subject: [PATCH] Removed unused code --- .../scanner/AbstractScannerTestCase.java | 48 ++----------------- 1 file changed, 3 insertions(+), 45 deletions(-) diff --git a/text/src/test/java/org/jboss/forge/addon/text/highlight/scanner/AbstractScannerTestCase.java b/text/src/test/java/org/jboss/forge/addon/text/highlight/scanner/AbstractScannerTestCase.java index 0f2600eb3c..8b94b2a9fd 100644 --- a/text/src/test/java/org/jboss/forge/addon/text/highlight/scanner/AbstractScannerTestCase.java +++ b/text/src/test/java/org/jboss/forge/addon/text/highlight/scanner/AbstractScannerTestCase.java @@ -25,8 +25,9 @@ public abstract class AbstractScannerTestCase private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); - public static final String ASSERT_ENCODER = "TEST"; - { + static final String ASSERT_ENCODER = "TEST"; + + static { Syntax.builtIns(); Encoder.Factory.registrer(ASSERT_ENCODER, AssertEncoder.class); } @@ -84,47 +85,4 @@ protected void assertMatchExample(Syntax.Builder builder, String type, String ex } Assert.assertEquals(expectedContent, result); } - - static byte[] asByteArray(final InputStream in) throws IllegalArgumentException - { - // Precondition check - if (in == null) - { - throw new IllegalArgumentException("stream must be specified"); - } - - // Get content as an array of bytes - final ByteArrayOutputStream out = new ByteArrayOutputStream(8192); - final int len = 4096; - final byte[] buffer = new byte[len]; - int read = 0; - try - { - while (((read = in.read(buffer)) != -1)) - { - out.write(buffer, 0, read); - } - } - catch (final IOException ioe) - { - throw new RuntimeException("Error in obtainting bytes from " + in, ioe); - } - finally - { - try - { - in.close(); - } - catch (final IOException ignore) - { - } - // We don't need to close the outstream, it's a byte array out - } - - // Represent as byte array - final byte[] content = out.toByteArray(); - - // Return - return content; - } }