Skip to content

Commit

Permalink
java: port Matcher test to harness
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <[email protected]>
  • Loading branch information
hdonnay committed Aug 21, 2024
1 parent 0066d63 commit 2c933d4
Show file tree
Hide file tree
Showing 5 changed files with 838 additions and 220 deletions.
7 changes: 3 additions & 4 deletions java/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ package java

import (
"context"
"net/url"

"github.com/quay/claircore"
"github.com/quay/claircore/libvuln/driver"
"github.com/quay/zlog"
"net/url"
)

// Matcher matches discovered Java Maven packages against advisories provided via OSV.
type Matcher struct{}

var (
_ driver.Matcher = (*Matcher)(nil)
)
var _ driver.Matcher = (*Matcher)(nil)

// Name implements driver.Matcher.
func (*Matcher) Name() string { return "java-maven" }
Expand Down
94 changes: 0 additions & 94 deletions java/matcher_integration_test.go

This file was deleted.

9 changes: 8 additions & 1 deletion java/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/quay/zlog"

"github.com/quay/claircore"
"github.com/quay/claircore/test"
)

func TestVulnerable(t *testing.T) {
matcher := &Matcher{}

testcases := []struct {
name string
record *claircore.IndexRecord
vuln *claircore.Vulnerability
name string
want bool
}{
{
Expand Down Expand Up @@ -199,3 +202,7 @@ func TestVulnerable(t *testing.T) {
})
}
}

func TestMatcher(t *testing.T) {
test.RunMatcherTests(zlog.Test(context.Background(), t), t, "testdata/matcher", new(Matcher))
}
121 changes: 0 additions & 121 deletions java/testdata/indexreport-buster-jackson-databind.json

This file was deleted.

Loading

0 comments on commit 2c933d4

Please sign in to comment.