blob: 975cc16213da11bcbfafff5e303503283219444d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package org.traccar.helper;
import org.junit.Assert;
import org.junit.Test;
public class PatternBuilderTest {
@Test
public void testPatternBuilder() {
Assert.assertEquals("\\$GPRMC", new PatternBuilder().text("$GPRMC").toString());
Assert.assertEquals("(\\d{2}\\.[0-9a-fA-F]+)", new PatternBuilder().number("(dd.x+)").toString());
Assert.assertEquals("a(?:bc)?", new PatternBuilder().text("a").text("b").text("c").optional(2).toString());
Assert.assertEquals("a|b", new PatternBuilder().expression("a|b").toString());
Assert.assertEquals("ab\\|", new PatternBuilder().expression("ab|").toString());
Assert.assertEquals("|", new PatternBuilder().or().toString());
Assert.assertEquals("\\|\\d|\\d\\|", new PatternBuilder().number("|d|d|").toString());
}
}
|