### Question:
SwiftObjectMemIo extends BaseMemIo implements ObjectMemIo<T> { @Override void ensureCapacity(long pos) { if (pos < mem.length) { return; } if (pos > MAX_ARRAY_SIZE) { throw new IllegalArgumentException(String.format("pos >= MAX_ARRAY_SIZE, pos: %d", pos)); } mem = Arrays.copyOf(mem, expand(mem.length, pos)); } SwiftObjectMemIo();  SwiftObjectMemIo(int cap); @Override T get(long pos); @Override boolean isReadable(); @Override void put(long pos, T val); @Override void release();  }### Answer:
@Test public void ensureCapacity() { SwiftObjectMemIo<Integer> objectMemIo = new SwiftObjectMemIo<Integer>(1); objectMemIo.put(0, 1); objectMemIo.put(1, 2); try { objectMemIo.put(BaseMemIo.MAX_ARRAY_SIZE, 3); fail(); } catch (Throwable ignore) { } }