File: Object2ObjectMapTest.java

package info (click to toggle)
libfastutil-java 8.5.16%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,208 kB
  • sloc: java: 19,706; sh: 1,188; makefile: 473; xml: 354
file content (27 lines) | stat: -rw-r--r-- 731 bytes parent folder | download
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
package it.unimi.dsi.fastutil.objects;

import org.junit.Test;

import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;

public class Object2ObjectMapTest {

	@Test
	public void testSmallMaps() {
		assertTrue(Object2ObjectMap.ofEntries() instanceof Object2ObjectMaps.EmptyMap);
		assertTrue(Object2ObjectMap.ofEntries(Object2ObjectMap.entry(new Object(), new Object())) instanceof Object2ObjectMaps.Singleton);
	}

	@Test
	public void testThrowOnDuplicate() {
		assertThrows(IllegalArgumentException.class, () -> Object2ObjectMap.ofEntries(
				Object2ObjectMap.entry("dupe", "foo"),
				Object2ObjectMap.entry("not a dupe", "bar"),
				Object2ObjectMap.entry("dupe", "exception")
				)
		);
	}


}