### Question:
TSTargetFactory { public static Either<String,TSTargetType> createTSTargetByDSL(String mappingString) { LOG.fine(() -> "creating TSTarget by DSL " + mappingString); Either<String, dz.jtsgen.processor.dsl.model.TypeMappingExpression> expr = CustomMappingParserFactory.parser().parse(mappingString); Either<String, TSTargetType> result = expr.check("LHS of mapping DSL must not be empty", x -> !x.names().isEmpty()) .map(x -> new TSTargetDeclType(x,null, true)); return result; }  static Either<String,TSTargetType> createTSTargetByDSL(String mappingString); static Either<String,TSTargetType> createTSTargetByDSLWithNS(String mappingString); static TSTargetType createTSTargetFromArray(TSTargetType embeddedType);  }### Answer:
@Test void test_createTSTargetByMapping_Type_Param() { createTSTargetByDSL("java.util.Collection<T> -> Array<T>").map( x -> { assertEquals(x.typeParameters(), Collections.singletonList("T")); assertEquals(x.getJavaType(),"java.util.Collection"); assertTrue(x.isReferenceType()); assertEquals(x.typeParameterTypes(), new HashMap<>()); return x; } ).orElseThrow(AssertionError::new); }
@Test void test_createTSTargetByMapping_Type_TS_Literal() { createTSTargetByDSL("java.util.List<T> -> `T`[]").map( x -> { assertEquals(x.typeParameters(), Collections.singletonList("T")); assertEquals(x.getJavaType(),"java.util.List"); assertTrue(x.isReferenceType()); assertEquals(x.typeParameterTypes(), new HashMap<>()); return x; } ).orElseThrow(AssertionError::new); }
@Test void test_createTSTargetByMapping_Two_Types_Param() { createTSTargetByDSL("java.util.Map<K,V> -> Map<K,V>").map( x -> { assertEquals(x.typeParameters(), Arrays.asList("K","V")); assertEquals(x.getJavaType(),"java.util.Map"); assertTrue(x.isReferenceType()); assertEquals(x.typeParameterTypes(), new HashMap<>()); return x; } ).orElseThrow(AssertionError::new); }