Search in sources :

Example 21 with Segment

use of org.nutz.lang.segment.Segment in project nutz by nutzam.

the class CharSegmentTest method testAtTheBegin.

@Test
public void testAtTheBegin() {
    Segment seg = Segments.create("${4}B");
    seg.set("4", "zzh");
    assertEquals("zzhB", seg.toString());
    assertEquals(1, seg.keys().size());
    assertEquals(2, seg.values().size());
}
Also used : CharSegment(org.nutz.lang.segment.CharSegment) Segment(org.nutz.lang.segment.Segment) Test(org.junit.Test)

Example 22 with Segment

use of org.nutz.lang.segment.Segment in project nutz by nutzam.

the class CharSegmentTest method testNormal.

@Test
public void testNormal() {
    Segment seg = Segments.create("H${4}B");
    seg.set("4", "zzh");
    assertEquals("H${4}B", seg.getOrginalString());
    assertEquals("HzzhB", seg.toString());
    assertEquals(1, seg.keys().size());
    assertEquals(3, seg.values().size());
}
Also used : CharSegment(org.nutz.lang.segment.CharSegment) Segment(org.nutz.lang.segment.Segment) Test(org.junit.Test)

Aggregations

CharSegment (org.nutz.lang.segment.CharSegment)22 Segment (org.nutz.lang.segment.Segment)22 Test (org.junit.Test)21