package error import "testing" func TestDatabase_Error(t *testing.T) { type fields struct { Reason string } tests := []struct { name string fields fields want string }{ { name: "Test 1: Reason", fields: fields{Reason: "TEST ERROR"}, want: "Database error: TEST ERROR", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { e := Database{ Reason: tt.fields.Reason, } if got := e.Error(); got != tt.want { t.Errorf("Error() = %v, want %v", got, tt.want) } }) } }