tavern/errors/errors_generated_test.go

841 lines
30 KiB
Go

// Code generated by go generate; DO NOT EDIT.
// This file was generated by herr at 2020-02-25 12:24:47.40365038 -0500 EST m=+0.012451131
package errors
import (
"fmt"
"testing"
"errors"
)
func TestNotFound (t *testing.T) {
err1 := NewNotFoundError(nil)
{
err1, ok := err1.(NotFoundError)
if !ok {
t.Errorf("Assertion failed on NotFound: %T is not NotFoundError", err1)
}
if err1.Prefix() != "TAV" {
t.Errorf("Assertion failed on NotFound: %s != TAV", err1.Prefix())
}
if err1.Code() != 1 {
t.Errorf("Assertion failed on NotFound: %d != 1", err1.Code())
}
if err1.Description() != "Not found." {
t.Errorf("Assertion failed on NotFound: %s != Not found.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewNotFoundError(errThingNotFound)
{
err2, ok := err2.(NotFoundError)
if !ok {
t.Errorf("Assertion failed on NotFound: %T is not NotFoundError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 1 {
t.Errorf("Assertion failed on NotFound: %d != 1", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on NotFound: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on NotFound: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, NotFoundError{}) {
t.Errorf("Assertion failed on NotFound: NotFoundError{} not identified correctly")
}
if !errors.Is(errNestErr2, NotFoundError{}) {
t.Errorf("Assertion failed on NotFound: NotFoundError{} not identified correctly")
}
}
}
func TestEncryptFailed (t *testing.T) {
err1 := NewEncryptFailedError(nil)
{
err1, ok := err1.(EncryptFailedError)
if !ok {
t.Errorf("Assertion failed on EncryptFailed: %T is not EncryptFailedError", err1)
}
if err1.Prefix() != "TAV" {
t.Errorf("Assertion failed on EncryptFailed: %s != TAV", err1.Prefix())
}
if err1.Code() != 2 {
t.Errorf("Assertion failed on EncryptFailed: %d != 2", err1.Code())
}
if err1.Description() != "Encrypting data failed." {
t.Errorf("Assertion failed on EncryptFailed: %s != Encrypting data failed.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewEncryptFailedError(errThingNotFound)
{
err2, ok := err2.(EncryptFailedError)
if !ok {
t.Errorf("Assertion failed on EncryptFailed: %T is not EncryptFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 2 {
t.Errorf("Assertion failed on EncryptFailed: %d != 2", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on EncryptFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on EncryptFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, EncryptFailedError{}) {
t.Errorf("Assertion failed on EncryptFailed: EncryptFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, EncryptFailedError{}) {
t.Errorf("Assertion failed on EncryptFailed: EncryptFailedError{} not identified correctly")
}
}
}
func TestDecryptFailed (t *testing.T) {
err1 := NewDecryptFailedError(nil)
{
err1, ok := err1.(DecryptFailedError)
if !ok {
t.Errorf("Assertion failed on DecryptFailed: %T is not DecryptFailedError", err1)
}
if err1.Prefix() != "TAV" {
t.Errorf("Assertion failed on DecryptFailed: %s != TAV", err1.Prefix())
}
if err1.Code() != 3 {
t.Errorf("Assertion failed on DecryptFailed: %d != 3", err1.Code())
}
if err1.Description() != "Decrypting data failed." {
t.Errorf("Assertion failed on DecryptFailed: %s != Decrypting data failed.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewDecryptFailedError(errThingNotFound)
{
err2, ok := err2.(DecryptFailedError)
if !ok {
t.Errorf("Assertion failed on DecryptFailed: %T is not DecryptFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 3 {
t.Errorf("Assertion failed on DecryptFailed: %d != 3", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on DecryptFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on DecryptFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, DecryptFailedError{}) {
t.Errorf("Assertion failed on DecryptFailed: DecryptFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, DecryptFailedError{}) {
t.Errorf("Assertion failed on DecryptFailed: DecryptFailedError{} not identified correctly")
}
}
}
func TestQueryFailed (t *testing.T) {
err1 := NewQueryFailedError(nil)
{
err1, ok := err1.(QueryFailedError)
if !ok {
t.Errorf("Assertion failed on QueryFailed: %T is not QueryFailedError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on QueryFailed: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 1 {
t.Errorf("Assertion failed on QueryFailed: %d != 1", err1.Code())
}
if err1.Description() != "The query operation failed." {
t.Errorf("Assertion failed on QueryFailed: %s != The query operation failed.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewQueryFailedError(errThingNotFound)
{
err2, ok := err2.(QueryFailedError)
if !ok {
t.Errorf("Assertion failed on QueryFailed: %T is not QueryFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 1 {
t.Errorf("Assertion failed on QueryFailed: %d != 1", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on QueryFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on QueryFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, QueryFailedError{}) {
t.Errorf("Assertion failed on QueryFailed: QueryFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, QueryFailedError{}) {
t.Errorf("Assertion failed on QueryFailed: QueryFailedError{} not identified correctly")
}
}
}
func TestDatabaseTransactionFailed (t *testing.T) {
err1 := NewDatabaseTransactionFailedError(nil)
{
err1, ok := err1.(DatabaseTransactionFailedError)
if !ok {
t.Errorf("Assertion failed on DatabaseTransactionFailed: %T is not DatabaseTransactionFailedError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on DatabaseTransactionFailed: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 2 {
t.Errorf("Assertion failed on DatabaseTransactionFailed: %d != 2", err1.Code())
}
if err1.Description() != "The database transaction failed." {
t.Errorf("Assertion failed on DatabaseTransactionFailed: %s != The database transaction failed.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewDatabaseTransactionFailedError(errThingNotFound)
{
err2, ok := err2.(DatabaseTransactionFailedError)
if !ok {
t.Errorf("Assertion failed on DatabaseTransactionFailed: %T is not DatabaseTransactionFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 2 {
t.Errorf("Assertion failed on DatabaseTransactionFailed: %d != 2", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on DatabaseTransactionFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on DatabaseTransactionFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, DatabaseTransactionFailedError{}) {
t.Errorf("Assertion failed on DatabaseTransactionFailed: DatabaseTransactionFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, DatabaseTransactionFailedError{}) {
t.Errorf("Assertion failed on DatabaseTransactionFailed: DatabaseTransactionFailedError{} not identified correctly")
}
}
}
func TestInsertQueryFailed (t *testing.T) {
err1 := NewInsertQueryFailedError(nil)
{
err1, ok := err1.(InsertQueryFailedError)
if !ok {
t.Errorf("Assertion failed on InsertQueryFailed: %T is not InsertQueryFailedError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on InsertQueryFailed: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 3 {
t.Errorf("Assertion failed on InsertQueryFailed: %d != 3", err1.Code())
}
if err1.Description() != "The insert query failed" {
t.Errorf("Assertion failed on InsertQueryFailed: %s != The insert query failed", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewInsertQueryFailedError(errThingNotFound)
{
err2, ok := err2.(InsertQueryFailedError)
if !ok {
t.Errorf("Assertion failed on InsertQueryFailed: %T is not InsertQueryFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 3 {
t.Errorf("Assertion failed on InsertQueryFailed: %d != 3", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on InsertQueryFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on InsertQueryFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, InsertQueryFailedError{}) {
t.Errorf("Assertion failed on InsertQueryFailed: InsertQueryFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, InsertQueryFailedError{}) {
t.Errorf("Assertion failed on InsertQueryFailed: InsertQueryFailedError{} not identified correctly")
}
}
}
func TestSelectQueryFailed (t *testing.T) {
err1 := NewSelectQueryFailedError(nil)
{
err1, ok := err1.(SelectQueryFailedError)
if !ok {
t.Errorf("Assertion failed on SelectQueryFailed: %T is not SelectQueryFailedError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on SelectQueryFailed: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 4 {
t.Errorf("Assertion failed on SelectQueryFailed: %d != 4", err1.Code())
}
if err1.Description() != "The select query failed" {
t.Errorf("Assertion failed on SelectQueryFailed: %s != The select query failed", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewSelectQueryFailedError(errThingNotFound)
{
err2, ok := err2.(SelectQueryFailedError)
if !ok {
t.Errorf("Assertion failed on SelectQueryFailed: %T is not SelectQueryFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 4 {
t.Errorf("Assertion failed on SelectQueryFailed: %d != 4", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on SelectQueryFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on SelectQueryFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, SelectQueryFailedError{}) {
t.Errorf("Assertion failed on SelectQueryFailed: SelectQueryFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, SelectQueryFailedError{}) {
t.Errorf("Assertion failed on SelectQueryFailed: SelectQueryFailedError{} not identified correctly")
}
}
}
func TestUpdateQueryFailed (t *testing.T) {
err1 := NewUpdateQueryFailedError(nil)
{
err1, ok := err1.(UpdateQueryFailedError)
if !ok {
t.Errorf("Assertion failed on UpdateQueryFailed: %T is not UpdateQueryFailedError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on UpdateQueryFailed: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 5 {
t.Errorf("Assertion failed on UpdateQueryFailed: %d != 5", err1.Code())
}
if err1.Description() != "The update query failed" {
t.Errorf("Assertion failed on UpdateQueryFailed: %s != The update query failed", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewUpdateQueryFailedError(errThingNotFound)
{
err2, ok := err2.(UpdateQueryFailedError)
if !ok {
t.Errorf("Assertion failed on UpdateQueryFailed: %T is not UpdateQueryFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 5 {
t.Errorf("Assertion failed on UpdateQueryFailed: %d != 5", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on UpdateQueryFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on UpdateQueryFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, UpdateQueryFailedError{}) {
t.Errorf("Assertion failed on UpdateQueryFailed: UpdateQueryFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, UpdateQueryFailedError{}) {
t.Errorf("Assertion failed on UpdateQueryFailed: UpdateQueryFailedError{} not identified correctly")
}
}
}
func TestInvalidUserID (t *testing.T) {
err1 := NewInvalidUserIDError(nil)
{
err1, ok := err1.(InvalidUserIDError)
if !ok {
t.Errorf("Assertion failed on InvalidUserID: %T is not InvalidUserIDError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on InvalidUserID: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 6 {
t.Errorf("Assertion failed on InvalidUserID: %d != 6", err1.Code())
}
if err1.Description() != "The user ID is invalid." {
t.Errorf("Assertion failed on InvalidUserID: %s != The user ID is invalid.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewInvalidUserIDError(errThingNotFound)
{
err2, ok := err2.(InvalidUserIDError)
if !ok {
t.Errorf("Assertion failed on InvalidUserID: %T is not InvalidUserIDError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 6 {
t.Errorf("Assertion failed on InvalidUserID: %d != 6", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on InvalidUserID: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on InvalidUserID: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, InvalidUserIDError{}) {
t.Errorf("Assertion failed on InvalidUserID: InvalidUserIDError{} not identified correctly")
}
if !errors.Is(errNestErr2, InvalidUserIDError{}) {
t.Errorf("Assertion failed on InvalidUserID: InvalidUserIDError{} not identified correctly")
}
}
}
func TestUserNotFound (t *testing.T) {
err1 := NewUserNotFoundError(nil)
{
err1, ok := err1.(UserNotFoundError)
if !ok {
t.Errorf("Assertion failed on UserNotFound: %T is not UserNotFoundError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on UserNotFound: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 7 {
t.Errorf("Assertion failed on UserNotFound: %d != 7", err1.Code())
}
if err1.Description() != "The user was not found." {
t.Errorf("Assertion failed on UserNotFound: %s != The user was not found.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewUserNotFoundError(errThingNotFound)
{
err2, ok := err2.(UserNotFoundError)
if !ok {
t.Errorf("Assertion failed on UserNotFound: %T is not UserNotFoundError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 7 {
t.Errorf("Assertion failed on UserNotFound: %d != 7", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on UserNotFound: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on UserNotFound: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, UserNotFoundError{}) {
t.Errorf("Assertion failed on UserNotFound: UserNotFoundError{} not identified correctly")
}
if !errors.Is(errNestErr2, UserNotFoundError{}) {
t.Errorf("Assertion failed on UserNotFound: UserNotFoundError{} not identified correctly")
}
}
}
func TestCreateUserFailed (t *testing.T) {
err1 := NewCreateUserFailedError(nil)
{
err1, ok := err1.(CreateUserFailedError)
if !ok {
t.Errorf("Assertion failed on CreateUserFailed: %T is not CreateUserFailedError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on CreateUserFailed: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 8 {
t.Errorf("Assertion failed on CreateUserFailed: %d != 8", err1.Code())
}
if err1.Description() != "The user was not able to be created." {
t.Errorf("Assertion failed on CreateUserFailed: %s != The user was not able to be created.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewCreateUserFailedError(errThingNotFound)
{
err2, ok := err2.(CreateUserFailedError)
if !ok {
t.Errorf("Assertion failed on CreateUserFailed: %T is not CreateUserFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 8 {
t.Errorf("Assertion failed on CreateUserFailed: %d != 8", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on CreateUserFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on CreateUserFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, CreateUserFailedError{}) {
t.Errorf("Assertion failed on CreateUserFailed: CreateUserFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, CreateUserFailedError{}) {
t.Errorf("Assertion failed on CreateUserFailed: CreateUserFailedError{} not identified correctly")
}
}
}
func TestUserQueryFailed (t *testing.T) {
err1 := NewUserQueryFailedError(nil)
{
err1, ok := err1.(UserQueryFailedError)
if !ok {
t.Errorf("Assertion failed on UserQueryFailed: %T is not UserQueryFailedError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on UserQueryFailed: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 9 {
t.Errorf("Assertion failed on UserQueryFailed: %d != 9", err1.Code())
}
if err1.Description() != "The user query failed." {
t.Errorf("Assertion failed on UserQueryFailed: %s != The user query failed.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewUserQueryFailedError(errThingNotFound)
{
err2, ok := err2.(UserQueryFailedError)
if !ok {
t.Errorf("Assertion failed on UserQueryFailed: %T is not UserQueryFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 9 {
t.Errorf("Assertion failed on UserQueryFailed: %d != 9", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on UserQueryFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on UserQueryFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, UserQueryFailedError{}) {
t.Errorf("Assertion failed on UserQueryFailed: UserQueryFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, UserQueryFailedError{}) {
t.Errorf("Assertion failed on UserQueryFailed: UserQueryFailedError{} not identified correctly")
}
}
}
func TestUpdateUserFailed (t *testing.T) {
err1 := NewUpdateUserFailedError(nil)
{
err1, ok := err1.(UpdateUserFailedError)
if !ok {
t.Errorf("Assertion failed on UpdateUserFailed: %T is not UpdateUserFailedError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on UpdateUserFailed: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 10 {
t.Errorf("Assertion failed on UpdateUserFailed: %d != 10", err1.Code())
}
if err1.Description() != "The user was not able to be updated." {
t.Errorf("Assertion failed on UpdateUserFailed: %s != The user was not able to be updated.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewUpdateUserFailedError(errThingNotFound)
{
err2, ok := err2.(UpdateUserFailedError)
if !ok {
t.Errorf("Assertion failed on UpdateUserFailed: %T is not UpdateUserFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 10 {
t.Errorf("Assertion failed on UpdateUserFailed: %d != 10", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on UpdateUserFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on UpdateUserFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, UpdateUserFailedError{}) {
t.Errorf("Assertion failed on UpdateUserFailed: UpdateUserFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, UpdateUserFailedError{}) {
t.Errorf("Assertion failed on UpdateUserFailed: UpdateUserFailedError{} not identified correctly")
}
}
}
func TestUserSessionNotFound (t *testing.T) {
err1 := NewUserSessionNotFoundError(nil)
{
err1, ok := err1.(UserSessionNotFoundError)
if !ok {
t.Errorf("Assertion failed on UserSessionNotFound: %T is not UserSessionNotFoundError", err1)
}
if err1.Prefix() != "TAVDAT" {
t.Errorf("Assertion failed on UserSessionNotFound: %s != TAVDAT", err1.Prefix())
}
if err1.Code() != 11 {
t.Errorf("Assertion failed on UserSessionNotFound: %d != 11", err1.Code())
}
if err1.Description() != "The user session was not found." {
t.Errorf("Assertion failed on UserSessionNotFound: %s != The user session was not found.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewUserSessionNotFoundError(errThingNotFound)
{
err2, ok := err2.(UserSessionNotFoundError)
if !ok {
t.Errorf("Assertion failed on UserSessionNotFound: %T is not UserSessionNotFoundError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 11 {
t.Errorf("Assertion failed on UserSessionNotFound: %d != 11", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on UserSessionNotFound: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on UserSessionNotFound: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, UserSessionNotFoundError{}) {
t.Errorf("Assertion failed on UserSessionNotFound: UserSessionNotFoundError{} not identified correctly")
}
if !errors.Is(errNestErr2, UserSessionNotFoundError{}) {
t.Errorf("Assertion failed on UserSessionNotFound: UserSessionNotFoundError{} not identified correctly")
}
}
}
func TestInvalidEmailVerification (t *testing.T) {
err1 := NewInvalidEmailVerificationError(nil)
{
err1, ok := err1.(InvalidEmailVerificationError)
if !ok {
t.Errorf("Assertion failed on InvalidEmailVerification: %T is not InvalidEmailVerificationError", err1)
}
if err1.Prefix() != "TAVWEB" {
t.Errorf("Assertion failed on InvalidEmailVerification: %s != TAVWEB", err1.Prefix())
}
if err1.Code() != 1 {
t.Errorf("Assertion failed on InvalidEmailVerification: %d != 1", err1.Code())
}
if err1.Description() != "Invalid verification." {
t.Errorf("Assertion failed on InvalidEmailVerification: %s != Invalid verification.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewInvalidEmailVerificationError(errThingNotFound)
{
err2, ok := err2.(InvalidEmailVerificationError)
if !ok {
t.Errorf("Assertion failed on InvalidEmailVerification: %T is not InvalidEmailVerificationError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 1 {
t.Errorf("Assertion failed on InvalidEmailVerification: %d != 1", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on InvalidEmailVerification: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on InvalidEmailVerification: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, InvalidEmailVerificationError{}) {
t.Errorf("Assertion failed on InvalidEmailVerification: InvalidEmailVerificationError{} not identified correctly")
}
if !errors.Is(errNestErr2, InvalidEmailVerificationError{}) {
t.Errorf("Assertion failed on InvalidEmailVerification: InvalidEmailVerificationError{} not identified correctly")
}
}
}
func TestCannotSaveSession (t *testing.T) {
err1 := NewCannotSaveSessionError(nil)
{
err1, ok := err1.(CannotSaveSessionError)
if !ok {
t.Errorf("Assertion failed on CannotSaveSession: %T is not CannotSaveSessionError", err1)
}
if err1.Prefix() != "TAVWEB" {
t.Errorf("Assertion failed on CannotSaveSession: %s != TAVWEB", err1.Prefix())
}
if err1.Code() != 2 {
t.Errorf("Assertion failed on CannotSaveSession: %d != 2", err1.Code())
}
if err1.Description() != "Cannot save session." {
t.Errorf("Assertion failed on CannotSaveSession: %s != Cannot save session.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewCannotSaveSessionError(errThingNotFound)
{
err2, ok := err2.(CannotSaveSessionError)
if !ok {
t.Errorf("Assertion failed on CannotSaveSession: %T is not CannotSaveSessionError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 2 {
t.Errorf("Assertion failed on CannotSaveSession: %d != 2", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on CannotSaveSession: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on CannotSaveSession: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, CannotSaveSessionError{}) {
t.Errorf("Assertion failed on CannotSaveSession: CannotSaveSessionError{} not identified correctly")
}
if !errors.Is(errNestErr2, CannotSaveSessionError{}) {
t.Errorf("Assertion failed on CannotSaveSession: CannotSaveSessionError{} not identified correctly")
}
}
}
func TestInvalidCaptcha (t *testing.T) {
err1 := NewInvalidCaptchaError(nil)
{
err1, ok := err1.(InvalidCaptchaError)
if !ok {
t.Errorf("Assertion failed on InvalidCaptcha: %T is not InvalidCaptchaError", err1)
}
if err1.Prefix() != "TAVWEB" {
t.Errorf("Assertion failed on InvalidCaptcha: %s != TAVWEB", err1.Prefix())
}
if err1.Code() != 3 {
t.Errorf("Assertion failed on InvalidCaptcha: %d != 3", err1.Code())
}
if err1.Description() != "Invalid captcha." {
t.Errorf("Assertion failed on InvalidCaptcha: %s != Invalid captcha.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewInvalidCaptchaError(errThingNotFound)
{
err2, ok := err2.(InvalidCaptchaError)
if !ok {
t.Errorf("Assertion failed on InvalidCaptcha: %T is not InvalidCaptchaError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 3 {
t.Errorf("Assertion failed on InvalidCaptcha: %d != 3", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on InvalidCaptcha: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on InvalidCaptcha: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, InvalidCaptchaError{}) {
t.Errorf("Assertion failed on InvalidCaptcha: InvalidCaptchaError{} not identified correctly")
}
if !errors.Is(errNestErr2, InvalidCaptchaError{}) {
t.Errorf("Assertion failed on InvalidCaptcha: InvalidCaptchaError{} not identified correctly")
}
}
}
func TestEmailSendFailed (t *testing.T) {
err1 := NewEmailSendFailedError(nil)
{
err1, ok := err1.(EmailSendFailedError)
if !ok {
t.Errorf("Assertion failed on EmailSendFailed: %T is not EmailSendFailedError", err1)
}
if err1.Prefix() != "TAVWEB" {
t.Errorf("Assertion failed on EmailSendFailed: %s != TAVWEB", err1.Prefix())
}
if err1.Code() != 4 {
t.Errorf("Assertion failed on EmailSendFailed: %d != 4", err1.Code())
}
if err1.Description() != "Unable to send email." {
t.Errorf("Assertion failed on EmailSendFailed: %s != Unable to send email.", err1.Description())
}
}
errNotFound := fmt.Errorf("not found")
errThingNotFound := fmt.Errorf("thing: %w", errNotFound)
err2 := NewEmailSendFailedError(errThingNotFound)
{
err2, ok := err2.(EmailSendFailedError)
if !ok {
t.Errorf("Assertion failed on EmailSendFailed: %T is not EmailSendFailedError", err2)
}
errNestErr2 := fmt.Errorf("oh snap: %w", err2)
if err2.Code() != 4 {
t.Errorf("Assertion failed on EmailSendFailed: %d != 4", err2.Code())
}
if !errors.Is(err2, errNotFound) {
t.Errorf("Assertion failed on EmailSendFailed: errNotFound not unwrapped correctly")
}
if !errors.Is(err2, errThingNotFound) {
t.Errorf("Assertion failed on EmailSendFailed: errThingNotFound not unwrapped correctly")
}
if !errors.Is(err2, EmailSendFailedError{}) {
t.Errorf("Assertion failed on EmailSendFailed: EmailSendFailedError{} not identified correctly")
}
if !errors.Is(errNestErr2, EmailSendFailedError{}) {
t.Errorf("Assertion failed on EmailSendFailed: EmailSendFailedError{} not identified correctly")
}
}
}