### Question:
Convert { public static Optional<Envelope> toEnvelope(Object obj) { if(obj instanceof Envelope) { return Optional.of((Envelope)obj); } if (obj instanceof String) { Envelope env = Bounds.parse(obj.toString()); if (env != null) { return Optional.of(env); } } return toGeometry(obj).map(new Function<Geometry, Envelope>() { @Override public Envelope apply(Geometry value) { return value.getEnvelopeInternal(); } }); }  static Optional<T> to(Object obj, Class<T> clazz); static Optional<T> to(Object obj, Class<T> clazz, boolean safe); static Optional<String> toString(Object obj); static Optional<Boolean> toBoolean(Object obj); static Optional<Path> toPath(Object obj); static Optional<File> toFile(Object obj); static Optional<URL> toURL(Object obj); static Optional<URI> toURI(Object obj); static Optional<T> toNumber(Object obj, Class<T> clazz); static Optional<List<T>> toNumbers(Object obj, Class<T> clazz); static Optional<Number> toNumber(Object obj); static Optional<Reader> toReader(Object obj); static Optional<Geometry> toGeometry(Object obj); static Optional<Envelope> toEnvelope(Object obj);  }### Answer:
@Test public void testConvertToEnvelope() { Envelope e = Convert.toEnvelope("POINT (0 0)").get(); assertEquals(0d, e.getMinX(), 0.1); assertEquals(0d, e.getMaxX(), 0.1); assertEquals(0d, e.getMinY(), 0.1); assertEquals(0d, e.getMaxY(), 0.1); e = Convert.toEnvelope("1, 2, 3, 4").get(); assertEquals(1d, e.getMinX(), 0.1); assertEquals(3d, e.getMaxX(), 0.1); assertEquals(2d, e.getMinY(), 0.1); assertEquals(4d, e.getMaxY(), 0.1); }