Example #1
0
  @Test
  public void testDefaultHeaderFormat() {
    final Header header = Header.DEFAULT;
    final Identifier identifier = header.getIdentifier();
    assertSame(Header.Identifier.INSTANCE, identifier);
    assertArrayEquals(new byte[] {'B', 'X', 'M', 'L', 0x00}, identifier.getName());
    assertArrayEquals(new byte[] {(byte) 0xFF, 0x0D, 0x0A}, identifier.getBinaryCheck());

    final Header.Version version = header.getVersion();
    assertSame(Header.Version.DEFAULT_VERSION, version);

    final Compression compression = header.getCompression();
    assertSame(Compression.NO_COMPRESSION, compression);

    final Flags flags = header.getFlags();
    final int flags1 = flags.getFlags1();
    int expectedFlags1 = 0x00;
    // isLittleEndian = true
    expectedFlags1 |= 0x01;
    // charsAreLittleEndian = true
    // expectedFlags1 |= 0x02;
    // hasRandomAccessInfo = false
    // expectedFlags1 |= 0x10;

    final String msg =
        Integer.toBinaryString(expectedFlags1) + " != " + Integer.toBinaryString(flags1);
    assertEquals(msg, expectedFlags1, flags1);

    final int flags2 = flags.getFlags2();
    assertEquals(0x00, flags2);
  }
 public void testGetFlags() {
   assertTrue(h1_flags.equals(header1.getFlags()));
 }