IntentSlotRenderer { public Slot renderSlot(String slotName, SlotTypeDefinition slotType, IntentData intentData) { IntentSlotData data = intentData.getSlots().get(slotName); List<String> samples = null; if (data != null && !data.getSamples().isEmpty()) { samples = new ArrayList<>(data.getSamples()); } return Slot.builder() .withName(slotName) .withType(slotType.getName()) .withSamples(samples) .build(); }  Slot renderSlot(String slotName, SlotTypeDefinition slotType, IntentData intentData); DialogSlot renderDialogSlot(IntentDefinition intentDefinition, String slotName, SlotTypeDefinition slotType, IntentSlotData slotData); List<Prompt> renderSlotPrompts(IntentDefinition intentDefinition, String slotName, IntentSlotData slotData);  }
@Test public void testRenderSlot_NoData() { Slot expected = Slot.builder() .withName("slot_name") .withType("slot_type") .withSamples(null) .build(); Slot actual = underTest.renderSlot("slot_name", mockSlotTypeDefinition, IntentData.builder().build()); assertEquals(expected, actual); }
@Test public void testRenderSlot_AddSamples() { Slot expected = Slot.builder() .withName("slot_name") .withType("slot_type") .withSamples(Collections.singletonList("test")) .build(); Slot actual = underTest.renderSlot("slot_name", mockSlotTypeDefinition, IntentData.builder() .addSlot("slot_name", IntentSlotData.builder() .addSamples(Collections.singletonList("test")) .build()) .build()); assertEquals(expected, actual); }