### Question:
PreferencesValidator { public static Optional<String> validateMongoUriSyntax(Context context, String mongoUriString) { try { new MongoClientURI(mongoUriString); } catch (IllegalArgumentException e) { return Optional.of(context.getString(R.string.illegal_mongo_uri)); } return Optional.absent(); }  static Optional<String> validateMongoUriSyntax(Context context, String mongoUriString); static Optional<String> validateRestApiUriSyntax(Context context, String restApiUri);  }### Answer:
@Test public void testValidateMongoUriSyntax_Empty() { assertThat(PreferencesValidator.validateMongoUriSyntax(getContext(), "").get(), is(getContext().getString(R.string.illegal_mongo_uri, ""))); }
@Test public void testValidateMongoUriSyntax_Invalid() { assertThat(PreferencesValidator.validateMongoUriSyntax(getContext(), "test/db").get(), is(getContext().getString(R.string.illegal_mongo_uri, "test/db"))); }
@Test public void testValidateMongoUriSyntax_Valid() { assertThat(PreferencesValidator.validateMongoUriSyntax(getContext(), "mongodb: .isPresent(), is(false)); }