### Question:
DataTypeHandler { List<DataType> forEachSubDataTypesByType(final String type, final Consumer<DataType> consumer) { return new DataTypeQuery().where(dataType -> Objects.equals(dataType.getType(), type)).apply(consumer).collect(); } DataTypeHandler(final DataTypeStore dataTypeStore,
                    final DataTypeManager dataTypeManager); void init(final ItemDefinitionRecordEngine recordEngine);  }### Answer:
@Test public void testForEachSubDataTypesByType() { final String type = "tCity"; final DataType dataType0 = makeDataType("tPerson", "Structure"); final DataType dataType1 = makeDataType("tCity", "Structure"); final DataType dataType2 = makeDataType("city1", "tCity"); final DataType dataType3 = makeDataType("city2", "tCity"); final DataType dataType4 = makeDataType("tCompany", "Structure"); when(dataTypeStore.getTopLevelDataTypes()).thenReturn(asList(dataType0, dataType1, dataType2, dataType3, dataType4)); final List<DataType> actualDataTypes = new ArrayList<>(); final List<DataType> expectedDataTypes = asList(dataType2, dataType3); final List<DataType> forEachSubDataTypesByType = handler.forEachSubDataTypesByType(type, actualDataTypes::add); assertEquals(expectedDataTypes, actualDataTypes); assertEquals(expectedDataTypes, forEachSubDataTypesByType); }