}
@Test(expected = BSONException.class)
public void nullCharacterInRegexStringShouldThrowException() {
BasicBSONEncoder encoder = new BasicBSONEncoder();
encoder.set(new BasicOutputBuffer());
encoder._putObjectField("key", Pattern.compile("hello\u0000World"));
}