@Test public void testTokenizerNesting() { CurlyBraceTokenizer tok = new CurlyBraceTokenizer("foo{bar{baz}}blah"); assertEquals("foo", tok.next()); assertEquals("{bar{baz}}", tok.next()); assertEquals("blah", tok.next()); assertFalse(tok.hasNext()); }
@Test public void testTokenizerNoClosing() { CurlyBraceTokenizer tok = new CurlyBraceTokenizer("foo{bar}baz{blah"); assertEquals("foo", tok.next()); assertEquals("{bar}", tok.next()); assertEquals("baz", tok.next()); assertEquals("{blah", tok.next()); assertFalse(tok.hasNext()); }
@Test public void testTokenizerNoOpening() { CurlyBraceTokenizer tok = new CurlyBraceTokenizer("foo}bar}baz"); assertEquals("foo}bar}baz", tok.next()); assertFalse(tok.hasNext()); }
@Test public void testTokenizerNoBraces() { CurlyBraceTokenizer tok = new CurlyBraceTokenizer("nobraces"); assertEquals("nobraces", tok.next()); assertFalse(tok.hasNext()); }