Debian Codegraph @

test/uk/me/parabola/imgfmt/app/labelenc/LabelEncTest.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2014.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 or
6 * version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 */
13 package uk.me.parabola.imgfmt.app.labelenc;
14
15 import org.junit.Test;
16
17 import static org.junit.Assert.*;
18
19 public class LabelEncTest {
20
21 private static final char[] EMPTY_CHARS = new char[0];
22 private static final byte[] EMPTY_BYTES = new byte[0];
23
24 @Test
25 public void testHashForNull() {
26 EncodedText enc = new EncodedText(null, 0, null);
27 assertEquals(0, enc.hashCode());
28 }
29
30 @Test
31 public void testHashForEmpty() {
32 EncodedText enc = new EncodedText(EMPTY_BYTES, 0, EMPTY_CHARS);
33 assertEquals(0, enc.hashCode());
34 }
35
36 @Test
37 public void testEmptyEqualsNull() {
38 EncodedText e1 = new EncodedText(null, 0, null);
39 EncodedText e2 = new EncodedText(EMPTY_BYTES, 0, EMPTY_CHARS);
40
41 assertEquals(e1, e2);
42 }
43 }