func TestCond(t *testing.T) {
	for _, tc := range []struct {
		in       error
		name     string
		cond     errors.MapCond
		expected bool
	}{
		{
			name: "Validation Error non pointer",
			cond: CondValidation(), in: &ValidationError{}, expected: false,
		},
		{
			name: "Validation Error base",
			cond: CondValidation(), in: ValidationError{key: true, field: "foo", reason: "bad foo", cause: fmt.Errorf("bad input")}, expected: true,
		},
		{
			name: "None Validation Error",
			cond: CondValidation(), in: fmt.Errorf("Not.Error"), expected: false,
		},
		{
			name: "CondFieldEq non pointer",
			cond: CondFieldEq("bar"), in: &ValidationError{field: "bar"}, expected: false,
		},
		{
			name: "CondFieldEq base",
			cond: CondFieldEq("foo"), in: ValidationError{field: "foo"}, expected: true,
		},
		{
			name: "CondFieldEq base bad",
			cond: CondFieldEq("foo"), in: ValidationError{field: "bar"}, expected: false,
		},
		{
			name: "CondFieldEq bad",
			cond: CondFieldEq("foo"), in: fmt.Errorf("foo"), expected: false,
		},
		{
			name: "CondReasonEq non pointer",
			cond: CondReasonEq("foo bar"), in: &ValidationError{reason: "foo bar"}, expected: false,
		},
		{
			name: "CondReasonEq base",
			cond: CondReasonEq("foo bar"), in: ValidationError{reason: "foo bar"}, expected: true,
		},
		{
			name: "CondReasonEq base bad",
			cond: CondReasonEq("foo"), in: ValidationError{reason: "foo foo"}, expected: false,
		},
		{
			name: "CondReasonEq bad",
			cond: CondReasonEq("foo bar"), in: fmt.Errorf("foo"), expected: false,
		},
	} {
		tc := tc
		t.Run(tc.name, func(t *testing.T) {
			if actual := tc.cond(tc.in); actual != tc.expected {
				t.Errorf("Test failed for %v, expected: %v; actual: %v", tc.name, tc.expected, actual)
			}
		})
	}
}
Test for the condition functions.
package validationerrors
import (
	"context"
	"fmt"
	"testing"
	"github.com/infobloxopen/atlas-app-toolkit/errors"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
)