### Question:
Optionality { public static DataValue optionalize(DataValue v, DataType dt) { Ensure.not_null(dt); if (!(dt instanceof OptionalDataType)) { Ensure.not_null(v); return v; } if (v != null) { v = unoptionalize(v); } OptionalDataType odt = (OptionalDataType) dt; DataType inner_type = odt.inner_type(); if (v != null && inner_type instanceof OptionalDataType) { v = optionalize(v, inner_type); } return odt.make(v); } private  Optionality(); static boolean is_optional(DataType dt); static boolean is_optional(DataValue dv); static DataType unoptionalize(DataType dt); static DataType deep_unoptionalize(DataType dt); static DataValue unoptionalize(DataValue dv); static DataValue deep_unoptionalize(DataValue dv); static DataValue optionalize(DataValue v, DataType dt); static boolean is_optional_of(DataType opt, DataType inner); static boolean is_deep_optional_of(DataType opt, DataType inner);  }### Answer:
@Test public void optionalize_non_null_to_normal_data_type() throws Exception { assertEquals(m_dv, Optionality.optionalize(m_dv, m_dt)); }
@Test public void optionalize_non_null_to_optional_data_type() throws Exception { assertEquals(m_odv, Optionality.optionalize(m_dv, m_odt)); }
@Test public void optionalize_non_null_to_deep_optional_data_type() throws Exception { assertEquals(m_oodv, Optionality.optionalize(m_dv, m_oodt)); }
@Test public void optionalize_null_to_optional_data_type() throws Exception { assertEquals(m_odvn, Optionality.optionalize(null, m_odt)); }
@Test public void optionalize_null_to_deep_optional_data_type() throws Exception { assertEquals(m_oodvn, Optionality.optionalize(null, m_oodt)); }
@Test public void optionalize_optional_non_null_value_to_optional_data_type() throws Exception { assertEquals(m_odv, Optionality.optionalize(m_odv, m_odt)); }
@Test public void optionalize_optional_non_null_value_to_deep_optional_data_type() throws Exception { assertEquals(m_oodv, Optionality.optionalize(m_odv, m_oodt)); }
@Test public void optionalize_optional_null_value_to_optional_data_type() throws Exception { assertEquals(m_odvn, Optionality.optionalize(m_odvn, m_odt)); }
@Test public void optionalize_optional_null_value_to_deep_optional_data_type() throws Exception { assertEquals(m_oodvn, Optionality.optionalize(m_odvn, m_oodt)); }
@Test public void optionalize_deep_optional_non_null_value_to_deep_optional() throws Exception { assertEquals(m_oodv, Optionality.optionalize(m_oodv, m_oodt)); }
@Test public void optionalize_deep_optional_null_value_to_deep_optional() throws Exception { assertEquals(m_oodvn, Optionality.optionalize(m_oodvn, m_oodt)); }