void addGetModelForKieBaseMethod(StringBuilder sb) {
        sb.append(
                "    public java.util.List<Model> getModelsForKieBase(String kieBaseName) {\n");
        if (!modelMethod.getKieBaseNames().isEmpty()) {
            sb.append( "        switch (kieBaseName) {\n");
            for (String kBase : modelMethod.getKieBaseNames()) {
                sb.append("            case \"" + kBase + "\": ");
                List<String> models = modelsByKBase.get(kBase);
                String collected = null;
                if (models != null) {
                    collected = models.stream()
                            .map(element -> "new " + element + "()")
                            .collect(Collectors.joining(","));
                }
                sb.append(collected != null && !collected.isEmpty() ?
                                  "return java.util.Arrays.asList( " + collected + " );\n" :
                                  "return getModels();\n");
            }
            sb.append("        }\n");
        }
        sb.append(
                "        throw new IllegalArgumentException(\"Unknown KieBase: \" + kieBaseName);\n" +
                        "    }\n" +
                        "\n" );
    }
@Test
    public void addGetModelForKieBaseMethodMatchingModelsByKBaseValuesTest() {
        KieBaseModel kieBaseModel = getKieBaseModel("ModelTest");
        Map<String, KieBaseModel> kBaseModels = new HashMap<>();
        kBaseModels.put("default-kie", kieBaseModel);
        List<String> modelByKBaseValues = Collections.singletonList("ModelTest");
        Map<String, List<String>> modelsByKBase = new HashMap<>();
        modelsByKBase.put("default-kie", modelByKBaseValues);
        ModelSourceClass modelSourceClass = new ModelSourceClass(RELEASE_ID, kBaseModels, modelsByKBase);
        StringBuilder sb = new StringBuilder();
        modelSourceClass.addGetModelForKieBaseMethod(sb);
        String retrieved = sb.toString();
        String expected = "switch (kieBaseName) {";
        assertThat(retrieved.contains(expected)).isTrue();
        expected = "case \"default-kie\": return java.util.Arrays.asList( new ModelTest() );";
        assertThat(retrieved.contains(expected)).isTrue();
    }