errverifytestwrappers

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VerifierIsMatchFunc     = "Test_Verifier"
	VerifyCollectionIsMatch = "Test_VerifierCollectionIsMatch"
)

Variables

View Source
var VerifyCollectionIsMatchTestCases = []VerifyErrorCollectionTestWrapper{
	{
		InputErrorCollections: []*errorwrapper.Wrapper{
			errnew.Type.Default(errtype.InvalidOption, errors.New("some thing went wrong")),
			errnew.Type.Default(errtype.NotSupportInWindows, errors.New("some thing went wrong: NotSupportInWindows")),
			errnew.Type.Default(errtype.NotSupportedOption, errors.New("some thing went wrong: NotSupportedOption")),
		},
		Verifier: errverify.CollectionVerifier{
			Verifier: errverify.Verifier{
				Header:       "Collection has 3 elements with 3 wrappers, verify length and it's content",
				FunctionName: VerifyCollectionIsMatch,
				VerifyAs:     stringcompareas.Equal,
				IsPrintError: true,
			},
			ExpectationLines: &corestr.SimpleSlice{
				Items: []string{
					"[Error (InvalidOption - #469): Selected option is invalid! some thing went wrong.]",
					"[Error (NotSupportInWindows - #93): Current request is not supported in Windows Operating system. some thing went wrong: NotSupportInWindows.]",
					"[Error (NotSupportedOption - #107): None of the option is supported. some thing went wrong: NotSupportedOption.]",
				},
			},
			ErrorLength: 3,
		},
	},
	{
		InputErrorCollections: []*errorwrapper.Wrapper{
			errnew.Type.Default(errtype.InvalidOption, errors.New("some thing went wrong")),
			errnew.Type.Default(errtype.NotSupportInWindows, errors.New("some thing went wrong: NotSupportInWindows")),
			errnew.Type.Default(errtype.NotSupportedOption, errors.New("some thing went wrong: NotSupportedOption")),
		},
		Verifier: errverify.CollectionVerifier{
			Verifier: errverify.Verifier{
				Header:       "Collection has 3 elements with 3 wrappers, verify it's content",
				FunctionName: VerifyCollectionIsMatch,
				VerifyAs:     stringcompareas.Equal,
				IsPrintError: true,
			},
			ExpectationLines: &corestr.SimpleSlice{
				Items: []string{
					"[Error (InvalidOption - #469): Selected option is invalid! some thing went wrong.]",
					"[Error (NotSupportInWindows - #93): Current request is not supported in Windows Operating system. some thing went wrong: NotSupportInWindows.]",
					"[Error (NotSupportedOption - #107): None of the option is supported. some thing went wrong: NotSupportedOption.]",
				},
			},
			ErrorLength: constants.InvalidValue,
		},
	},
}
View Source
var VerifyCollectionSliceValidatorTestCases = []VerifyErrorCollectionTestWrapper{
	{
		InputErrorCollections: []*errorwrapper.Wrapper{
			errnew.Type.Default(errtype.InvalidOption, errors.New("some thing went wrong")),
			errnew.Type.Default(errtype.NotSupportInWindows, errors.New("some thing went wrong: NotSupportInWindows")),
			errnew.Type.Default(errtype.NotSupportedOption, errors.New("some thing went wrong: NotSupportedOption")),
		},
		Verifier: errverify.CollectionVerifier{
			Verifier: errverify.Verifier{
				Header:       "Collection has 3 elements with 3 wrappers, verify length and it's content",
				FunctionName: VerifyCollectionIsMatch,
				VerifyAs:     stringcompareas.Equal,
				IsPrintError: true,
			},
			ExpectationLines: &corestr.SimpleSlice{
				Items: []string{
					"[Error (InvalidOption - #469): Selected option is invalid! some thing went wrong.]",
					"[Error (NotSupportInWindows - #93): Current request is not supported in Windows Operating system. some thing went wrong: NotSupportInWindows.]",
					"[Error (NotSupportedOption - #107): None of the option is supported. some thing went wrong: NotSupportedOption.]",
				},
			},
			ErrorLength: 3,
		},
	},
	{
		InputErrorCollections: []*errorwrapper.Wrapper{
			errnew.Type.Default(errtype.InvalidOption, errors.New("some thing went wrong")),
			errnew.Type.Default(errtype.NotSupportInWindows, errors.New("some thing went wrong: NotSupportInWindows")),
			errnew.Type.Default(errtype.NotSupportedOption, errors.New("some thing went wrong: NotSupportedOption")),
		},
		Verifier: errverify.CollectionVerifier{
			Verifier: errverify.Verifier{
				Header:       "Collection has 3 elements with 3 wrappers, verify it's content",
				FunctionName: VerifyCollectionIsMatch,
				VerifyAs:     stringcompareas.Equal,
				IsPrintError: true,
			},
			ExpectationLines: &corestr.SimpleSlice{
				Items: []string{
					"[Error (InvalidOption - #469): Selected option is invalid! some thing went wrong.]",
					"[Error (NotSupportInWindows - #93): Current request is not supported in Windows Operating system. some thing went wrong: NotSupportInWindows.]",
					"[Error (NotSupportedOption - #107): None of the option is supported. some thing went wrong: NotSupportedOption.]",
				},
			},
			ErrorLength: constants.InvalidValue,
		},
	},
}
View Source
var VerifyIsMatchTestCases = []VerifyTestWrapper{
	{
		Verifier: errverify.Verifier{
			Header:       "Path location error wrapper validation",
			FunctionName: VerifierIsMatchFunc,
			ExpectingMessage: "[Error (PathMismatch - #298): " +
				"Path mismatch error, expectation didn't meet! " +
				"Additional : my demo message. Ref(s) " +
				"{[Path (string): \"location 1\"]}]",
			VerifyAs:                 stringcompareas.Equal,
			IsCompareEmpty:           false,
			IsVerifyErrorMessageOnly: false,
			IsPrintError:             true,
		},
		ErrorWrapper: errnew.Path.Messages(
			errtype.PathMismatch,
			"location 1",
			"my demo message"),
	},
	{
		Verifier: errverify.Verifier{
			Header:                   "Path location error validation",
			FunctionName:             VerifierIsMatchFunc,
			ExpectingMessage:         "my demo message",
			VerifyAs:                 stringcompareas.Equal,
			IsCompareEmpty:           false,
			IsVerifyErrorMessageOnly: true,
			IsPrintError:             true,
		},
		ErrorWrapper: errnew.Path.Messages(
			errtype.PathMismatch,
			"location 1",
			"my demo message"),
	},
	{
		Verifier: errverify.Verifier{
			Header:                   "Path location error validation",
			FunctionName:             VerifierIsMatchFunc,
			ExpectingMessage:         "my demo message",
			VerifyAs:                 stringcompareas.Equal,
			IsCompareEmpty:           false,
			IsVerifyErrorMessageOnly: true,
			IsPrintError:             true,
		},
		ErrorWrapper: errnew.Path.Messages(
			errtype.PathMismatch,
			"location 1",
			"my demo message"),
	},
	{
		Verifier: errverify.Verifier{
			Header:                   "Path location empty validation",
			FunctionName:             VerifierIsMatchFunc,
			ExpectingMessage:         "",
			VerifyAs:                 stringcompareas.Equal,
			IsCompareEmpty:           true,
			IsVerifyErrorMessageOnly: true,
			IsPrintError:             true,
		},
		ErrorWrapper: nil,
	},
	{
		Verifier: errverify.Verifier{
			Header:                   "Path location empty validation",
			FunctionName:             VerifierIsMatchFunc,
			ExpectingMessage:         "",
			VerifyAs:                 stringcompareas.Equal,
			IsCompareEmpty:           true,
			IsVerifyErrorMessageOnly: true,
			IsPrintError:             true,
		},
		ErrorWrapper: nil,
	},
}
View Source
var VerifyValidatorTestCases = []VerifyTestWrapper{
	{
		Verifier: errverify.Verifier{
			Header:       "Path location error wrapper validation",
			FunctionName: VerifierIsMatchFunc,
			ExpectingMessage: "[Error (PathMismatch - #298): " +
				"Path mismatch error, expectation didn't meet! " +
				"Additional : my demo message. Ref(s) " +
				"{[Path (string): \"location 1\"]}]",
			VerifyAs:                 stringcompareas.Equal,
			IsCompareEmpty:           false,
			IsVerifyErrorMessageOnly: false,
			IsPrintError:             true,
		},
		ErrorWrapper: errnew.Path.Messages(
			errtype.PathMismatch,
			"location 1",
			"my demo message"),
	},
	{
		Verifier: errverify.Verifier{
			Header:                   "Path location error validation",
			FunctionName:             VerifierIsMatchFunc,
			ExpectingMessage:         "my demo message",
			VerifyAs:                 stringcompareas.Equal,
			IsCompareEmpty:           false,
			IsVerifyErrorMessageOnly: true,
			IsPrintError:             true,
		},
		ErrorWrapper: errnew.Path.Messages(
			errtype.PathMismatch,
			"location 1",
			"my demo message"),
	},
	{
		Verifier: errverify.Verifier{
			Header:                   "Path location error validation",
			FunctionName:             VerifierIsMatchFunc,
			ExpectingMessage:         "my demo message",
			VerifyAs:                 stringcompareas.Equal,
			IsCompareEmpty:           false,
			IsVerifyErrorMessageOnly: true,
			IsPrintError:             true,
		},
		ErrorWrapper: errnew.Path.Messages(
			errtype.PathMismatch,
			"location 1",
			"my demo message"),
	},
	{
		Verifier: errverify.Verifier{
			Header:                   "Path location error validation",
			FunctionName:             VerifierIsMatchFunc,
			ExpectingMessage:         "my demo message",
			VerifyAs:                 stringcompareas.Equal,
			IsCompareEmpty:           true,
			IsVerifyErrorMessageOnly: true,
			IsPrintError:             true,
		},
		ErrorWrapper: errnew.Path.Messages(
			errtype.PathMismatch,
			"location 1",
			"my demo message"),
	},
}

Functions

This section is empty.

Types

type VerifyErrorCollectionTestWrapper

type VerifyErrorCollectionTestWrapper struct {
	InputErrorCollections []*errorwrapper.Wrapper
	Verifier              errverify.CollectionVerifier
}

type VerifyTestWrapper

type VerifyTestWrapper struct {
	ErrorWrapper *errorwrapper.Wrapper
	Verifier     errverify.Verifier
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL