-
Notifications
You must be signed in to change notification settings - Fork 268
Expand file tree
/
Copy pathPathMatcherTests.groovy
More file actions
30 lines (24 loc) · 963 Bytes
/
Copy pathPathMatcherTests.groovy
File metadata and controls
30 lines (24 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package ua.naiksoftware.stomp
import org.junit.Test
import ua.naiksoftware.stomp.dto.StompCommand
import ua.naiksoftware.stomp.dto.StompHeader
import ua.naiksoftware.stomp.dto.StompMessage
import ua.naiksoftware.stomp.pathmatcher.RabbitPathMatcher
class PathMatcherTests extends Configuration {
@Test
def "rmq-style matcher must return expected value"() {
given:
def matcher = new RabbitPathMatcher()
expect:
matcher.matches(path, message(dest)) == value
where:
path | dest | value
'lorem/*/ipsum' | 'lorem/any/ipsum' | true
'lorem/*/ipsum' | 'lorem/ipsum' | false
'lorem/*/prefix*' | 'lorem/ipsum/prefix123'| true
'lorem/*/pref*3' | 'lorem/ipsum/prefix123'| true
}
def message(String dest) {
return new StompMessage(StompCommand.MESSAGE, [new StompHeader(StompHeader.DESTINATION, dest)], null)
}
}