Skip to content

Commit a1092af

Browse files
committed
Make MockEntity implement Entity directly
1 parent 6165fc5 commit a1092af

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

database/query_builder_test.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,35 @@ package database
22

33
import (
44
"github.com/icinga/icinga-go-library/testutils"
5+
"strconv"
56
"testing"
67
)
78

89
type MockEntity struct {
9-
Entity
10-
Id int
10+
Id Id
1111
Name string
1212
Age int
1313
Email string
1414
}
1515

16+
type Id int
17+
18+
func (i Id) String() string {
19+
return strconv.Itoa(int(i))
20+
}
21+
22+
func (m MockEntity) ID() ID {
23+
return m.Id
24+
}
25+
26+
func (m MockEntity) SetID(id ID) {
27+
m.Id = id.(Id)
28+
}
29+
30+
func (m MockEntity) Fingerprint() Fingerprinter {
31+
return m
32+
}
33+
1634
func TestInsertStatement(t *testing.T) {
1735
tests := []testutils.TestCase[string, testutils.InsertStatementTestData]{
1836
{

0 commit comments

Comments
 (0)