public void testEnsureCapacity() { assertSame(EMPTY, Booleans.ensureCapacity(EMPTY, 0, 1)); assertSame(ARRAY_FALSE, Booleans.ensureCapacity(ARRAY_FALSE, 0, 1)); assertSame(ARRAY_FALSE, Booleans.ensureCapacity(ARRAY_FALSE, 1, 1)); assertTrue( Arrays.equals( new boolean[] {true, false, false}, Booleans.ensureCapacity(new boolean[] {true}, 2, 1))); }
public void testEnsureCapacity_fail() { try { Booleans.ensureCapacity(ARRAY_FALSE, -1, 1); fail(); } catch (IllegalArgumentException expected) { } try { // notice that this should even fail when no growth was needed Booleans.ensureCapacity(ARRAY_FALSE, 1, -1); fail(); } catch (IllegalArgumentException expected) { } }
public void testEnsureCapacity() { assertSame(EMPTY, Booleans.ensureCapacity(EMPTY, 0, 1)); assertSame(ARRAY_FALSE, Booleans.ensureCapacity(ARRAY_FALSE, 0, 1)); assertSame(ARRAY_FALSE, Booleans.ensureCapacity(ARRAY_FALSE, 1, 1)); assertTrue(Arrays.equals( new boolean[] {true, false, false}, Booleans.ensureCapacity(new boolean[] {true}, 2, 1))); }
public void testEnsureCapacity_fail() { try { Booleans.ensureCapacity(ARRAY_FALSE, -1, 1); fail(); } catch (IllegalArgumentException expected) { } try { // notice that this should even fail when no growth was needed Booleans.ensureCapacity(ARRAY_FALSE, 1, -1); fail(); } catch (IllegalArgumentException expected) { } }