From 58e9c70f18b570754152515dbe6c2a6e657e08b1 Mon Sep 17 00:00:00 2001
From: Christoph Petrausch <christoph.petrausch@inovex.de>
Date: Tue, 29 May 2018 06:00:34 +0200
Subject: [PATCH] provide an constructor for TermCondition

---
 routingtable/filter/term_condition.go      | 7 +++++++
 routingtable/filter/term_condition_test.go | 8 ++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/routingtable/filter/term_condition.go b/routingtable/filter/term_condition.go
index 92c3616a..8bc87485 100644
--- a/routingtable/filter/term_condition.go
+++ b/routingtable/filter/term_condition.go
@@ -10,6 +10,13 @@ type TermCondition struct {
 	routeFilters []*RouteFilter
 }
 
+func NewTermCondition(prefixLists []*PrefixList, routeFilters []*RouteFilter) *TermCondition {
+	return &TermCondition{
+		prefixLists:  prefixLists,
+		routeFilters: routeFilters,
+	}
+}
+
 func (f *TermCondition) Matches(p net.Prefix, pa *route.Path) bool {
 	return f.matchesAnyPrefixList(p) || f.machtchesAnyRouteFilter(p)
 }
diff --git a/routingtable/filter/term_condition_test.go b/routingtable/filter/term_condition_test.go
index 876746a2..fba97b67 100644
--- a/routingtable/filter/term_condition_test.go
+++ b/routingtable/filter/term_condition_test.go
@@ -109,10 +109,10 @@ func TestMatches(t *testing.T) {
 
 	for _, test := range tests {
 		t.Run(test.name, func(te *testing.T) {
-			f := &TermCondition{
-				prefixLists:  test.prefixLists,
-				routeFilters: test.routeFilters,
-			}
+			f := NewTermCondition(
+				test.prefixLists,
+				test.routeFilters,
+			)
 
 			assert.Equal(te, test.expected, f.Matches(test.prefix, &route.Path{}))
 		})
-- 
GitLab