### Question:
BsonRegularExpression implements Bson { @Override public String toString() { Document representative = new Document("$regex", pattern); if (options != null) { representative.put("$options", options); } return Json.toJsonValue(representative); } BsonRegularExpression(String pattern, String options);  BsonRegularExpression(String pattern); Document toDocument(); static boolean isRegularExpression(Object object); static BsonRegularExpression convertToRegularExpression(Object pattern); String getPattern(); String getOptions(); @Override String toString(); Matcher matcher(String string);  }### Answer:
@Test void testToString() throws Exception { assertThat(new BsonRegularExpression(".*")).hasToString("{\"$regex\" : \".*\"}"); assertThat(new BsonRegularExpression(".*", "im")).hasToString("{\"$regex\" : \".*\", \"$options\" : \"im\"}"); }