public void testEmpty_first() { SortedSet<String> set = of(); try { set.first(); fail(); } catch (NoSuchElementException expected) { } }
public void testEmpty_last() { SortedSet<String> set = of(); try { set.last(); fail(); } catch (NoSuchElementException expected) { } }
@SuppressWarnings({"deprecation", "static-access"}) public void testBuilderMethod() { try { ImmutableSortedSet.builder(); fail(); } catch (UnsupportedOperationException expected) { } }
public void testExplicit_subSet() { SortedSet<String> set = ImmutableSortedSet.orderedBy(STRING_LENGTH) .add("in", "the", "quick", "jumped", "over", "a") .build(); assertTrue(set.subSet("the", "quick") instanceof ImmutableSortedSet); assertTrue(set.subSet("", "b") instanceof ImmutableSortedSet); assertThat(set.subSet("the", "quick")).containsExactly("the", "over").inOrder(); assertThat(set.subSet("a", "california")) .containsExactly("a", "in", "the", "over", "quick", "jumped") .inOrder(); assertTrue(set.subSet("", "b").isEmpty()); assertTrue(set.subSet("vermont", "california").isEmpty()); assertTrue(set.subSet("aaa", "zzz").isEmpty()); try { set.subSet("quick", "the"); fail(); } catch (IllegalArgumentException expected) { } }
public void testOf_subSet() { SortedSet<String> set = of("e", "f", "b", "d", "c"); assertTrue(set.subSet("c", "e") instanceof ImmutableSortedSet); assertThat(set.subSet("c", "e")).containsExactly("c", "d").inOrder(); assertThat(set.subSet("a", "g")).containsExactly("b", "c", "d", "e", "f").inOrder(); assertSame(of(), set.subSet("a", "b")); assertSame(of(), set.subSet("g", "h")); assertSame(of(), set.subSet("c", "c")); try { set.subSet("e", "c"); fail(); } catch (IllegalArgumentException expected) { } }
public void testEmpty_first() { SortedSet<String> set = of(); try { set.first(); fail(); } catch (NoSuchElementException expected) { } }
public void testEmpty_last() { SortedSet<String> set = of(); try { set.last(); fail(); } catch (NoSuchElementException expected) { } }
@SuppressWarnings({"deprecation", "static-access"}) public void testBuilderMethod() { try { ImmutableSortedSet.builder(); fail(); } catch (UnsupportedOperationException expected) { } }
public void testExplicit_subSet() { SortedSet<String> set = ImmutableSortedSet.orderedBy(STRING_LENGTH).add( "in", "the", "quick", "jumped", "over", "a").build(); assertTrue(set.subSet("the", "quick") instanceof ImmutableSortedSet); assertTrue(set.subSet("", "b") instanceof ImmutableSortedSet); assertThat(set.subSet("the", "quick")).containsExactly("the", "over").inOrder(); assertThat(set.subSet("a", "california")) .containsExactly("a", "in", "the", "over", "quick", "jumped").inOrder(); assertTrue(set.subSet("", "b").isEmpty()); assertTrue(set.subSet("vermont", "california").isEmpty()); assertTrue(set.subSet("aaa", "zzz").isEmpty()); try { set.subSet("quick", "the"); fail(); } catch (IllegalArgumentException expected) { } }
public void testOf_subSet() { SortedSet<String> set = of("e", "f", "b", "d", "c"); assertTrue(set.subSet("c", "e") instanceof ImmutableSortedSet); assertThat(set.subSet("c", "e")).containsExactly("c", "d").inOrder(); assertThat(set.subSet("a", "g")).containsExactly("b", "c", "d", "e", "f").inOrder(); assertSame(of(), set.subSet("a", "b")); assertSame(of(), set.subSet("g", "h")); assertSame(of(), set.subSet("c", "c")); try { set.subSet("e", "c"); fail(); } catch (IllegalArgumentException expected) { } }