### Question:
ExplicitType { public Type convertToType() { if (this.collectionId.endsWith("List")) { throw new RuntimeException("Collection_id cannot end with 'List'"); } Type convertedType = new Type(collectionId); Collection<Predicate> predicates = new HashSet<>(); if (fields == null || fields.isEmpty()) { return convertedType; } for (ExplicitField field : fields) { Predicate convertedPredicate = field.convertToPredicate(); convertedPredicate.setIsExplicit(true); predicates.add(convertedPredicate); } convertedType.setPredicates(predicates); return convertedType; } @JsonCreator  ExplicitType(@JsonProperty("collectionId") String collectionId,
                      @JsonProperty("fields") List<ExplicitField> fields); String getCollectionId(); List<ExplicitField> getFields(); Type convertToType();  }### Answer:
@Test public void convertToTypeConvertsExplicitTypeWithoutFieldsToType() { ExplicitType explicitType = new ExplicitType("TestType", null); Type type = explicitType.convertToType(); assertThat(type.getName(), is("TestType")); }
@Test public void convertToTypeConvertsExplicitTypeWithFieldsToType() { ExplicitField title = new ExplicitField("title", false, null,null); List<ExplicitField> fieldList = new ArrayList<>(); fieldList.add(title); ExplicitType explicitType = new ExplicitType("TestType", fieldList); Type type = explicitType.convertToType(); assertThat(type.getName(), is("TestType")); }