DataEventAttrBuilder { public static String toType(final String channelName, final ProcessInstance process) { Objects.requireNonNull(process); Objects.requireNonNull(channelName); return String.format(AbstractDataEvent.TYPE_FORMAT, process.getProcessId().toLowerCase(), channelName.toLowerCase()); } private  DataEventAttrBuilder(); static String toSource(final ProcessInstance process); static String toType(final String channelName, final ProcessInstance process); static String toType(final String channelName, final String processId);  }
@Test void verifyEventTypeBeingGenerated() { final String channelName = "github"; final String processId = "the_cool_project"; final String type = DataEventAttrBuilder.toType(channelName, processId); assertThat(type).isNotBlank().contains(processId).contains(channelName).startsWith(AbstractDataEvent.TYPE_PREFIX); }
@Test void verifyEventTypeBeingGeneratedWithProcessInstance() { final String channelName = "github"; final String processId = "COOL_PROJECT"; ProcessInstance pi = mock(ProcessInstance.class); when(pi.getProcessId()).thenReturn(processId); final String type = DataEventAttrBuilder.toType(channelName, pi); assertThat(type) .isNotBlank() .doesNotContain(processId) .contains(processId.toLowerCase()) .contains(channelName) .startsWith(AbstractDataEvent.TYPE_PREFIX); }