Home | History | Annotate | Download | only in enc
      1 /* Copyright 2018 Google Inc. All Rights Reserved.
      2 
      3    Distributed under MIT license.
      4    See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
      5 */
      6 
      7 package org.brotli.wrapper.enc;
      8 
      9 import static org.junit.Assert.assertEquals;
     10 
     11 import org.brotli.integration.BrotliJniTestBase;
     12 import org.brotli.wrapper.dec.Decoder;
     13 import java.io.IOException;
     14 import org.junit.Test;
     15 import org.junit.runner.RunWith;
     16 import org.junit.runners.JUnit4;
     17 
     18 /** Tests for {@link org.brotli.wrapper.enc.Encoder}. */
     19 @RunWith(JUnit4.class)
     20 public class EmptyInputTest extends BrotliJniTestBase {
     21   @Test
     22   public void testEmptyInput() throws IOException {
     23     byte[] data = new byte[0];
     24     byte[] encoded = Encoder.compress(data);
     25     assertEquals(1, encoded.length);
     26     byte[] decoded = Decoder.decompress(encoded);
     27     assertEquals(0, decoded.length);
     28   }
     29 }
     30