From 837f0c0100a395e6c9774f16b3984a9eaa609912 Mon Sep 17 00:00:00 2001 From: Oleg Schelykalnov Date: Tue, 3 Sep 2019 13:42:09 +0300 Subject: [PATCH] Test for unresolved generics Testcase from https://github.com/vojtechhabarta/typescript-generator/issues/380 --- .../typescript/generator/GenericsTest.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/typescript-generator-core/src/test/java/cz/habarta/typescript/generator/GenericsTest.java b/typescript-generator-core/src/test/java/cz/habarta/typescript/generator/GenericsTest.java index 716072ec0..8cd8f182d 100644 --- a/typescript-generator-core/src/test/java/cz/habarta/typescript/generator/GenericsTest.java +++ b/typescript-generator-core/src/test/java/cz/habarta/typescript/generator/GenericsTest.java @@ -223,9 +223,41 @@ class Page2 { class TableGA { public T[] rows; } - + interface ExecutionResult { public T getData(); } + @Test + public void testResolveParameter() { + final Settings settings = TestUtils.settings(); + final String output = new TypeScriptGenerator(settings).generateTypeScript(Input.from(Entity1View.class)); + final String nl = settings.newline; + final String expected = + "interface Entity1View extends Entity1IdView {" + nl + + " name: string;" + nl + + "}" + nl + + nl + + "interface Entity1IdView extends IdView {" + nl + + "}" + nl + + nl + + "interface IdView {" + nl + + " id: T;" + nl + + "}"; + assertEquals(expected, output.trim()); + } + + public interface IdView { + T getId(); + } + + public interface Entity1IdView extends IdView { + } + + public abstract class Entity1View implements Entity1IdView { + private String name; + + public String getName() { return name; } + } + }