func TestCreateAndRunService_Success(t *testing.T) {
	app := myApp{}
	mockFactory := func(_ string) (interfaces.ApplicationService, bool) {
		mockAppService := &mocks.ApplicationService{}
		mockAppService.On("LoggingClient").Return(logger.NewMockClient())
		mockAppService.On("GetAppSettingStrings", "DeviceNames").
			Return([]string{"Random-Boolean-Device, Random-Integer-Device"}, nil)
		mockAppService.On("SetDefaultFunctionsPipeline", mock.Anything, mock.Anything, mock.Anything, mock.Anything).
			Return(nil)
		mockAppService.On("AddFunctionsPipelineForTopics", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).
			Return(nil)
		mockAppService.On("LoadCustomConfig", mock.Anything, mock.Anything, mock.Anything).
			Return(nil).Run(func(args mock.Arguments) {
			app.serviceConfig.AppCustom.SomeValue = 987
			app.serviceConfig.AppCustom.SomeService.Host = "SomeHost"
		})
		mockAppService.On("ListenForCustomConfigChanges", mock.Anything, mock.Anything, mock.Anything).
			Return(nil)
		mockAppService.On("MakeItRun").Return(nil)
		return mockAppService, true
	}
	expected := 0
	actual := app.CreateAndRunAppService("TestKey", mockFactory)
	assert.Equal(t, expected, actual)
}
This is an example of how to test the code that would typically be in the main() function use mocks
Not to helpful for a simple main() , but can be if the main() has more complexity that should be unit tested
TODO: add/update tests for your customized CreateAndRunAppService or remove if your main code doesn't require unit testing.
package main
import (
	"fmt"
	"testing"
	"github.com/edgexfoundry/go-mod-core-contracts/v2/clients/logger"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/mock"
	"github.com/stretchr/testify/require"
	"github.com/edgexfoundry/app-functions-sdk-go/v2/pkg/interfaces"
	"github.com/edgexfoundry/app-functions-sdk-go/v2/pkg/interfaces/mocks"
)