@Test public void testRepeatedIncludes() { SkillModel skill = SkillModel.builder() .withInvocationName(Locales.en_US, "en_US") .addModel(Model.builder() .intent(TestIntentInherit.class) .build()) .build(); InteractionModel model = underTest.render(skill, Locales.en_US); Intent intent = model.getLanguageModel().getIntents().stream().findFirst().get(); assertEquals(Arrays.asList("merged", "merged2", "test_en_US"), intent.getSamples()); }
public InteractionModel render(SkillModel skillModel, Locale locale) { assertNotNull(skillModel, "skillDefinition"); assertNotNull(locale, "locale"); if (!skillModel.getInvocationNames().containsKey(locale)) { throw new IllegalArgumentException("no invocation name specified for locale: " + locale); } SubModel subModel = modelRenderer.render(skillModel.getModel(), locale); LanguageModel languageModel = LanguageModel.builder() .withInvocationName(skillModel.getInvocationNames().get(locale)) .withIntents(new ArrayList<>(subModel.getLanguageModel().getIntents())) .withTypes(new ArrayList<>(subModel.getLanguageModel().getTypes())) .build(); return InteractionModel.builder() .withLanguageModel(languageModel) .withDialog(subModel.getDialog()) .withPrompts(subModel.getPrompts()) .build(); }
InteractionModelRenderer { public InteractionModel render(SkillModel skillModel, Locale locale) { assertNotNull(skillModel, "skillDefinition"); assertNotNull(locale, "locale"); if (!skillModel.getInvocationNames().containsKey(locale)) { throw new IllegalArgumentException("no invocation name specified for locale: " + locale); } SubModel subModel = modelRenderer.render(skillModel.getModel(), locale); LanguageModel languageModel = LanguageModel.builder() .withInvocationName(skillModel.getInvocationNames().get(locale)) .withIntents(new ArrayList<>(subModel.getLanguageModel().getIntents())) .withTypes(new ArrayList<>(subModel.getLanguageModel().getTypes())) .build(); return InteractionModel.builder() .withLanguageModel(languageModel) .withDialog(subModel.getDialog()) .withPrompts(subModel.getPrompts()) .build(); } }
InteractionModelRenderer { public InteractionModel render(SkillModel skillModel, Locale locale) { assertNotNull(skillModel, "skillDefinition"); assertNotNull(locale, "locale"); if (!skillModel.getInvocationNames().containsKey(locale)) { throw new IllegalArgumentException("no invocation name specified for locale: " + locale); } SubModel subModel = modelRenderer.render(skillModel.getModel(), locale); LanguageModel languageModel = LanguageModel.builder() .withInvocationName(skillModel.getInvocationNames().get(locale)) .withIntents(new ArrayList<>(subModel.getLanguageModel().getIntents())) .withTypes(new ArrayList<>(subModel.getLanguageModel().getTypes())) .build(); return InteractionModel.builder() .withLanguageModel(languageModel) .withDialog(subModel.getDialog()) .withPrompts(subModel.getPrompts()) .build(); } InteractionModelRenderer(ModelRenderer modelRenderer);  InteractionModelRenderer(); }
InteractionModelRenderer { public InteractionModel render(SkillModel skillModel, Locale locale) { assertNotNull(skillModel, "skillDefinition"); assertNotNull(locale, "locale"); if (!skillModel.getInvocationNames().containsKey(locale)) { throw new IllegalArgumentException("no invocation name specified for locale: " + locale); } SubModel subModel = modelRenderer.render(skillModel.getModel(), locale); LanguageModel languageModel = LanguageModel.builder() .withInvocationName(skillModel.getInvocationNames().get(locale)) .withIntents(new ArrayList<>(subModel.getLanguageModel().getIntents())) .withTypes(new ArrayList<>(subModel.getLanguageModel().getTypes())) .build(); return InteractionModel.builder() .withLanguageModel(languageModel) .withDialog(subModel.getDialog()) .withPrompts(subModel.getPrompts()) .build(); } InteractionModelRenderer(ModelRenderer modelRenderer);  InteractionModelRenderer(); InteractionModel render(SkillModel skillModel, Locale locale); }
InteractionModelRenderer { public InteractionModel render(SkillModel skillModel, Locale locale) { assertNotNull(skillModel, "skillDefinition"); assertNotNull(locale, "locale"); if (!skillModel.getInvocationNames().containsKey(locale)) { throw new IllegalArgumentException("no invocation name specified for locale: " + locale); } SubModel subModel = modelRenderer.render(skillModel.getModel(), locale); LanguageModel languageModel = LanguageModel.builder() .withInvocationName(skillModel.getInvocationNames().get(locale)) .withIntents(new ArrayList<>(subModel.getLanguageModel().getIntents())) .withTypes(new ArrayList<>(subModel.getLanguageModel().getTypes())) .build(); return InteractionModel.builder() .withLanguageModel(languageModel) .withDialog(subModel.getDialog()) .withPrompts(subModel.getPrompts()) .build(); } InteractionModelRenderer(ModelRenderer modelRenderer);  InteractionModelRenderer(); InteractionModel render(SkillModel skillModel, Locale locale);  }