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
30 lines (23 loc) · 966 Bytes
/
TestSlice.java
File metadata and controls
30 lines (23 loc) · 966 Bytes
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
package com.jsoniter;
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")));
}
// Regression Test, revealed an error in the Slice.equals() method.
// Generated by Randoop.
public void test07() throws Throwable {
Slice slice1 = Slice.make("hi!");
// Checks the contract: !slice1.equals(null)
org.junit.Assert.assertTrue("Contract failed: !slice1.equals(null)", !slice1.equals(null));
}
}