From 8af94310494d912c9b09e851601e14cd46890c2a Mon Sep 17 00:00:00 2001 From: Diego Date: Mon, 22 Dec 2014 17:35:11 -0300 Subject: = core: modified version of GlobPathFilter and improve GlobPahFilterSpec --- .../test/scala/kamon/util/GlobPathFilterSpec.scala | 29 +++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'kamon-core/src/test/scala/kamon/util/GlobPathFilterSpec.scala') diff --git a/kamon-core/src/test/scala/kamon/util/GlobPathFilterSpec.scala b/kamon-core/src/test/scala/kamon/util/GlobPathFilterSpec.scala index 0611e169..e0b837f3 100644 --- a/kamon-core/src/test/scala/kamon/util/GlobPathFilterSpec.scala +++ b/kamon-core/src/test/scala/kamon/util/GlobPathFilterSpec.scala @@ -22,22 +22,33 @@ class GlobPathFilterSpec extends WordSpecLike with Matchers { "The GlobPathFilter" should { "match a single expression" in { - val filter = GlobPathFilter("/user/actor") + val filter = new GlobPathFilter("/user/actor") - filter.accept("/user/actor") should be (true) + filter.accept("/user/actor") shouldBe true - filter.accept("/user/actor/something") should be (false) - filter.accept("/user/actor/somethingElse") should be (false) + filter.accept("/user/actor/something") shouldBe false + filter.accept("/user/actor/somethingElse") shouldBe false } "match all expressions in the same level" in { - val filter = GlobPathFilter("/user/*") + val filter = new GlobPathFilter("/user/*") - filter.accept("/user/actor") should be (true) - filter.accept("/user/otherActor") should be (true) + filter.accept("/user/actor") shouldBe true + filter.accept("/user/otherActor") shouldBe true - filter.accept("/user/something/actor") should be (false) - filter.accept("/user/something/otherActor") should be (false) + filter.accept("/user/something/actor") shouldBe false + filter.accept("/user/something/otherActor") shouldBe false + } + + "match all expressions in all levels" in { + val filter = new GlobPathFilter("/user/actor-**") + + filter.accept("/user/actor-") shouldBe true + filter.accept("/user/actor-one") shouldBe true + filter.accept("/user/actor-one/other") shouldBe true + + filter.accept("/user/something/actor") shouldBe false + filter.accept("/user/something/otherActor")shouldBe false } } } -- cgit v1.2.3