### Question:
Utils { static void changeSubdocumentValue(Object document, String key, Object newValue, Integer matchPos) { changeSubdocumentValue(document, key, newValue, new AtomicReference<>(matchPos)); }  static Object getSubdocumentValue(Document document, String key); static Object getSubdocumentValueCollectionAware(Document document, String key); static String getDatabaseNameFromFullName(String fullName); static String getCollectionNameFromFullName(String fullName); static boolean isTrue(Object value); static Number normalizeNumber(Number value); static void markOkay(Document result); static String join(List<?> values, String delimiter); static void changeSubdocumentValue(Object document, String key, Object newValue); static void validateFieldNames(Document document); static Object removeSubdocumentValue(Object document, String key); static String describeType(Object value); static String joinTail(List<String> pathFragments); static String firstFragment(String input); static List<String> splitPath(String input); static String getShorterPathIfPrefix(String path1, String path2); static List<String> collectCommonPathFragments(String path1, String path2); static String getHostName(); static void copySubdocumentValue(Document input, Document result, String key); static final String PATH_DELIMITER; }### Answer:
@Test void testChangeSubdocumentValue() throws Exception { Document document = json("_id: 1, foo: {bar: 1, bla: 2}"); Utils.changeSubdocumentValue(document, "foo.bar", 3); assertThat(document).isEqualTo(json("_id: 1, foo: {bar: 3, bla: 2}")); Utils.changeSubdocumentValue(document, "foo.z", "value"); assertThat(document).isEqualTo(json("_id: 1, foo: {bar: 3, bla: 2, z: 'value'}")); Utils.changeSubdocumentValue(document, "foo", json("x: [1, 2, 3]")); assertThat(document).isEqualTo(json("_id: 1, foo: {x: [1, 2, 3]}")); Utils.changeSubdocumentValue(document, "foo.x.1", "new-value"); assertThat(document).isEqualTo(json("_id: 1, foo: {x: [1, 'new-value', 3]}")); Utils.changeSubdocumentValue(document, "foo.y", Arrays.asList(1, 2, 3)); assertThat(document).isEqualTo(json("_id: 1, foo: {x: [1, 'new-value', 3], y: [1, 2, 3]}")); }