### Question:
BsonRegularExpression implements Bson { public static BsonRegularExpression convertToRegularExpression(Object pattern) { Assert.isTrue(isRegularExpression(pattern), () -> "'" + pattern + "' is not a regular expression"); if (pattern instanceof BsonRegularExpression) { return (BsonRegularExpression) pattern; } else { return fromDocument((Document) pattern); } } 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 testConvertToRegularExpressionWithIllegalArgument() throws Exception { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> BsonRegularExpression.convertToRegularExpression("abc")) .withMessage("'abc' is not a regular expression"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> BsonRegularExpression.convertToRegularExpression(new Document())) .withMessage("'{}' is not a regular expression"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> BsonRegularExpression.convertToRegularExpression(new Document("foo", "bar"))) .withMessage("'{\"foo\" : \"bar\"}' is not a regular expression"); }