MongoClientURIConverter implements Converter<MongoClientURI> { @Override public String convertTo(MongoClientURI value) { if (value == null) { throw new ParameterException("Couldn't convert \"null\" to string."); } return value.toString(); }  @Override MongoClientURI convertFrom(String value); @Override String convertTo(MongoClientURI value);  }
@Test public void convertToWithNull() throws Exception { expectedException.expect(ParameterException.class); expectedException.expectMessage("Couldn't convert \"null\" to string."); new MongoClientURIConverter().convertTo(null); }
@Test public void convertToWithValidMongoClientURI() throws Exception { final MongoClientURI uri = new MongoClientURI("mongodb: final String s = new MongoClientURIConverter().convertTo(uri); assertEquals("mongodb: }