| 1 |
package sarif |
| 2 |
|
| 3 |
import ( |
| 4 |
"testing" |
| 5 |
|
| 6 |
"github.com/stretchr/testify/assert" |
| 7 |
) |
| 8 |
|
| 9 |
func Test_create_simple_location(t *testing.T) { |
| 10 |
l := NewLocation(). |
| 11 |
WithId(1). |
| 12 |
WithMessage( |
| 13 |
NewMessage(). |
| 14 |
WithID("messageId1"). |
| 15 |
WithText("message text")). |
| 16 |
WithAnnotations( |
| 17 |
[]*Region{NewRegion().WithByteLength(10)}, |
| 18 |
). |
| 19 |
WithRelationships([]*LocationRelationship{NewLocationRelationship(1)}) |
| 20 |
|
| 21 |
assert.Equal(t, `{"id":1,"message":{"text":"message text","id":"messageId1"},"annotations":[{"byteLength":10}],"relationships":[{"target":1}]}`, getJsonString(l)) |
| 22 |
} |