### Question:
DataTypeNameFormatValidator { public void ifIsValid(final DataType dataType, final Command onSuccess) { final String dataTypeName = dataType.getName(); clientServicesProxy.isValidVariableName(dataTypeName, getCallback(dataType, onSuccess)); } @Inject  DataTypeNameFormatValidator(final DMNClientServicesProxy clientServicesProxy,
                                       final Event<FlashMessage> flashMessageEvent,
                                       final DataTypeNameIsInvalidErrorMessage nameIsInvalidErrorMessage); void ifIsValid(final DataType dataType,
                          final Command onSuccess);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testIfIsValid() { final DataType dataType = mock(DataType.class); final Command onSuccess = mock(Command.class); final String dataTypeName = "name"; when(dataType.getName()).thenReturn(dataTypeName); validator.ifIsValid(dataType, onSuccess); verify(clientServicesProxy).isValidVariableName(eq(dataTypeName), any(ServiceCallback.class)); }