forked from json-iterator/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSlice.java
More file actions
50 lines (37 loc) · 1.43 KB
/
TestSlice.java
File metadata and controls
50 lines (37 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.jsoniter;
import com.jsoniter.spi.Slice;
import junit.framework.TestCase;
import java.util.HashMap;
public class TestSlice extends TestCase {
public void test_equals() {
assertTrue(Slice.make("hello").equals(Slice.make("hello")));
assertTrue(Slice.make("hello").equals(new Slice("ahello".getBytes(), 1, 6)));
}
public void test_hashcode() {
HashMap map = new HashMap();
map.put(Slice.make("hello"), "hello");
map.put(Slice.make("world"), "world");
assertEquals("hello", map.get(Slice.make("hello")));
assertEquals("world", map.get(Slice.make("world")));
}
public void test_equalsInputNotNullOutputFalse2() {
// Arrange
final byte[] byteArray = {(byte)2, (byte)1};
final Slice objectUnderTest = new Slice(byteArray, 0, 1073741825);
final byte[] byteArray1 = {(byte)0};
final Slice o = new Slice(byteArray1, 0, 1073741825);
// Act
final boolean retval = objectUnderTest.equals(o);
// Assert result
assertEquals(false, retval);
}
public void test_equalsInputNotNullOutputFalse() {
// Arrange
final Slice objectUnderTest = new Slice(null, 0, -2147483646);
final Slice o = new Slice(null, 0, 2);
// Act
final boolean retval = objectUnderTest.equals(o);
// Assert result
assertEquals(false, retval);
}
}