@Test
public void testGetValueAsInstanceOptional() throws IOException {

	// Present optional
	MultipartBody multipartBody = MultipartBody.of(
		Collections.emptyMap(), __ -> _objectMapper,
		Collections.singletonMap(
			"key",
			JSONUtil.put(
				"list", Arrays.asList(1, 2, 3)
			).put(
				"number", 42
			).put(
				"string", "Hello"
			).toString()));
	Optional<TestClass> testClassOptional =
		multipartBody.getValueAsInstanceOptional("key", TestClass.class);
	assertThat(testClassOptional.isPresent(), is(true));
	TestClass testClass = testClassOptional.get();
	assertThat(testClass.list, contains(1, 2, 3));
	assertThat(testClass.number, is(42L));
	assertThat(testClass.string, is("Hello"));
	assertThat(testClass.testClass, is(nullValue()));
	// Null optional
	testClassOptional = multipartBody.getValueAsInstanceOptional(
		"null", TestClass.class);
	assertThat(testClassOptional.isPresent(), is(false));
	// Incorrect JSON
	multipartBody = MultipartBody.of(
		Collections.emptyMap(), __ -> _objectMapper,
		Collections.singletonMap(
			"key",
			JSONUtil.put(
				"number", 42
			).put(
				"string", "Hello"
			).put(
				"wrongKey", Arrays.asList(1, 2, 3)
			).toString()));
	try {
		multipartBody.getValueAsInstance("key", TestClass.class);
		throw new AssertionError();
	}
	catch (Exception exception) {
		assertThat(
			exception, is(instanceOf(UnrecognizedPropertyException.class)));
	}
}