### Question:
VectorConverter implements IString2ValueConverter { @Override public Object parseString(final Class<?> impl, final String value) { if (impl.equals(IVector2.class)) { return parseVector2(value); } else if (impl.equals(IVector3.class)) { return parseVector3(value); } else if (impl.equals(IVectorN.class) || impl.equals(IVector.class)) { return parseVectorN(value); } return null; }  @Override boolean supportedClass(final Class<?> impl); @Override Object parseString(final Class<?> impl, final String value); @Override String toString(final Class<?> impl, final Object value);  }### Answer:
@Test public void testParseString() { assertThat(converter.parseString(IVector.class, "42;1337")).isEqualTo(Vector2.fromXY(42, 1337)); assertThat(converter.parseString(IVector2.class, "42;1337")).isEqualTo(Vector2.fromXY(42, 1337)); assertThat(converter.parseString(IVector3.class, "42;1337,3.14")).isEqualTo(Vector3.fromXYZ(42, 1337, 3.14)); assertThat(converter.parseString(IVectorN.class, "42;1337,3.14,-5")).isEqualTo(VectorN.from(42, 1337, 3.14, -5)); }
@Test public void testParseStringInvalid() { assertThat(converter.parseString(IVector2.class, "42;133a7")).isEqualTo(Vector2.zero()); assertThat(converter.parseString(IVector3.class, "42;1337,3.a14")).isEqualTo(Vector3.zero()); assertThat(converter.parseString(IVectorN.class, "42;1337,3.14,-5a")).isEqualTo(VectorN.zero(0)); assertThat(converter.parseString(IVector.class, "4a2;1337")).isEqualTo(VectorN.zero(0)); assertThat(converter.parseString(Object.class, "")).isNull(); }
@Test public void testParseStringInvalid() { Logger.getRootLogger().setLevel(Level.OFF); assertThat(converter.parseString(IVector2.class, "42;133a7")).isEqualTo(Vector2.zero()); assertThat(converter.parseString(IVector3.class, "42;1337,3.a14")).isEqualTo(Vector3.zero()); assertThat(converter.parseString(IVectorN.class, "42;1337,3.14,-5a")).isEqualTo(VectorN.zero(0)); assertThat(converter.parseString(IVector.class, "4a2;1337")).isEqualTo(VectorN.zero(0)); assertThat(converter.parseString(Object.class, "")).isNull(); Logger.getRootLogger().setLevel(Level.WARN); }