### Question:
SafeVector extends CommonsVector <ELEMENTTYPE> { @Override public synchronized ELEMENTTYPE get (@Nonnegative final int nIndex) { _ensureSize (nIndex); return super.get (nIndex); } SafeVector();  SafeVector(@Nonnull final Supplier <? extends ELEMENTTYPE> aFactory); @Nonnull Supplier <? extends ELEMENTTYPE> getFactory(); @Override synchronized ELEMENTTYPE get(@Nonnegative final int nIndex); @Nullable synchronized ELEMENTTYPE computeIfAbsent(@Nonnegative final int nIndex, @Nonnull final Supplier <? extends ELEMENTTYPE> aFactory); @Override synchronized ELEMENTTYPE set(@Nonnegative final int nIndex, @Nonnull final ELEMENTTYPE aElement); @Override synchronized boolean equals(final Object o); @Override synchronized int hashCode(); @Override synchronized String toString();  }### Answer:
@Test public void testSafeVectorNullFactory () { final SafeVector <String> sv = new SafeVector <> (); assertEquals (0, sv.size ()); assertNull (sv.get (0)); assertEquals (1, sv.size ()); assertNull (sv.get (10)); assertEquals (11, sv.size ()); for (final String sMember : sv) assertNull (sMember); }
@SuppressWarnings ("unused") @Test public void testSafeVectorNewInstanceFactory () { try { new SafeVector <String> (null); fail (); } catch (final NullPointerException ex) {} final SafeVector <String> sv = new SafeVector <> (FactoryNewInstance.create (String.class)); assertEquals (0, sv.size ()); assertNotNull (sv.get (0)); assertEquals (1, sv.size ()); assertNotNull (sv.get (10)); assertEquals (11, sv.size ()); for (final String sMember : sv) assertNotNull (sMember); }