Search in sources :

Example 1 with Dialect04

use of org.thymeleaf.dialect.dialectordering.Dialect04 in project thymeleaf-tests by thymeleaf.

the class DialectOrderingTest method testDialectOrder.

@Test
public void testDialectOrder() throws Exception {
    final Dialect01 dialect01 = new Dialect01();
    final Dialect02 dialect02 = new Dialect02();
    final Dialect03 dialect03 = new Dialect03();
    final Dialect04 dialect04 = new Dialect04();
    final Set<IElementProcessor> dialect01Processors = combineDialects(dialect01);
    final Set<IElementProcessor> dialect02Processors = combineDialects(dialect02);
    final Set<IElementProcessor> dialect03Processors = combineDialects(dialect03);
    final Set<IElementProcessor> dialect04Processors = combineDialects(dialect04);
    List<IProcessor> d01ProcList = new ArrayList<IProcessor>(dialect01Processors);
    List<IProcessor> d02ProcList = new ArrayList<IProcessor>(dialect02Processors);
    List<IProcessor> d03ProcList = new ArrayList<IProcessor>(dialect03Processors);
    List<IProcessor> d04ProcList = new ArrayList<IProcessor>(dialect04Processors);
    Assert.assertEquals(2, d01ProcList.size());
    Assert.assertEquals(2, d02ProcList.size());
    Assert.assertEquals(2, d03ProcList.size());
    Assert.assertEquals(3, d04ProcList.size());
    // 110 - 1000
    Assert.assertEquals(P1Processor.class.getSimpleName(), unwrappedClassName(d01ProcList.get(0)));
    // 110 - 1100
    Assert.assertEquals(Div1Processor.class.getSimpleName(), unwrappedClassName(d01ProcList.get(1)));
    // 100 -  900
    Assert.assertEquals(Div2Processor.class.getSimpleName(), unwrappedClassName(d02ProcList.get(0)));
    // 100 - 1100
    Assert.assertEquals(P2Processor.class.getSimpleName(), unwrappedClassName(d02ProcList.get(1)));
    // 90 -  800
    Assert.assertEquals(P3Processor.class.getSimpleName(), unwrappedClassName(d03ProcList.get(0)));
    // 90 -  900
    Assert.assertEquals(Span3Processor.class.getSimpleName(), unwrappedClassName(d03ProcList.get(1)));
    // 100 -  700
    Assert.assertEquals(Span4Processor.class.getSimpleName(), unwrappedClassName(d04ProcList.get(0)));
    // 100 - 1000
    Assert.assertEquals(Div4Processor.class.getSimpleName(), unwrappedClassName(d04ProcList.get(1)));
    // 100 - 1200
    Assert.assertEquals(P4Processor.class.getSimpleName(), unwrappedClassName(d04ProcList.get(2)));
    List<IElementProcessor> d0102ProcList = new ArrayList<IElementProcessor>(combineDialects(dialect01, dialect02));
    Assert.assertEquals(Div2Processor.class.getSimpleName(), unwrappedClassName(d0102ProcList.get(0)));
    Assert.assertEquals(P2Processor.class.getSimpleName(), unwrappedClassName(d0102ProcList.get(1)));
    Assert.assertEquals(P1Processor.class.getSimpleName(), unwrappedClassName(d0102ProcList.get(2)));
    Assert.assertEquals(Div1Processor.class.getSimpleName(), unwrappedClassName(d0102ProcList.get(3)));
    List<IElementProcessor> d0103ProcList = new ArrayList<IElementProcessor>(combineDialects(dialect01, dialect03));
    Assert.assertEquals(P3Processor.class.getSimpleName(), unwrappedClassName(d0103ProcList.get(0)));
    Assert.assertEquals(Span3Processor.class.getSimpleName(), unwrappedClassName(d0103ProcList.get(1)));
    Assert.assertEquals(P1Processor.class.getSimpleName(), unwrappedClassName(d0103ProcList.get(2)));
    Assert.assertEquals(Div1Processor.class.getSimpleName(), unwrappedClassName(d0103ProcList.get(3)));
    List<IElementProcessor> d0203ProcList = new ArrayList<IElementProcessor>(combineDialects(dialect02, dialect03));
    Assert.assertEquals(P3Processor.class.getSimpleName(), unwrappedClassName(d0203ProcList.get(0)));
    Assert.assertEquals(Span3Processor.class.getSimpleName(), unwrappedClassName(d0203ProcList.get(1)));
    Assert.assertEquals(Div2Processor.class.getSimpleName(), unwrappedClassName(d0203ProcList.get(2)));
    Assert.assertEquals(P2Processor.class.getSimpleName(), unwrappedClassName(d0203ProcList.get(3)));
    List<IElementProcessor> d010204ProcList = new ArrayList<IElementProcessor>(combineDialects(dialect01, dialect02, dialect04));
    Assert.assertEquals(Span4Processor.class.getSimpleName(), unwrappedClassName(d010204ProcList.get(0)));
    Assert.assertEquals(Div2Processor.class.getSimpleName(), unwrappedClassName(d010204ProcList.get(1)));
    Assert.assertEquals(Div4Processor.class.getSimpleName(), unwrappedClassName(d010204ProcList.get(2)));
    Assert.assertEquals(P2Processor.class.getSimpleName(), unwrappedClassName(d010204ProcList.get(3)));
    Assert.assertEquals(P4Processor.class.getSimpleName(), unwrappedClassName(d010204ProcList.get(4)));
    Assert.assertEquals(P1Processor.class.getSimpleName(), unwrappedClassName(d010204ProcList.get(5)));
    Assert.assertEquals(Div1Processor.class.getSimpleName(), unwrappedClassName(d010204ProcList.get(6)));
    List<IElementProcessor> d010402ProcList = new ArrayList<IElementProcessor>(combineDialects(dialect01, dialect04, dialect02));
    Assert.assertEquals(Span4Processor.class.getSimpleName(), unwrappedClassName(d010402ProcList.get(0)));
    Assert.assertEquals(Div2Processor.class.getSimpleName(), unwrappedClassName(d010402ProcList.get(1)));
    Assert.assertEquals(Div4Processor.class.getSimpleName(), unwrappedClassName(d010402ProcList.get(2)));
    Assert.assertEquals(P2Processor.class.getSimpleName(), unwrappedClassName(d010402ProcList.get(3)));
    Assert.assertEquals(P4Processor.class.getSimpleName(), unwrappedClassName(d010402ProcList.get(4)));
    Assert.assertEquals(P1Processor.class.getSimpleName(), unwrappedClassName(d010402ProcList.get(5)));
    Assert.assertEquals(Div1Processor.class.getSimpleName(), unwrappedClassName(d010402ProcList.get(6)));
    List<IElementProcessor> d030402ProcList = new ArrayList<IElementProcessor>(combineDialects(dialect03, dialect04, dialect02));
    Assert.assertEquals(P3Processor.class.getSimpleName(), unwrappedClassName(d030402ProcList.get(0)));
    Assert.assertEquals(Span3Processor.class.getSimpleName(), unwrappedClassName(d030402ProcList.get(1)));
    Assert.assertEquals(Span4Processor.class.getSimpleName(), unwrappedClassName(d030402ProcList.get(2)));
    Assert.assertEquals(Div2Processor.class.getSimpleName(), unwrappedClassName(d030402ProcList.get(3)));
    Assert.assertEquals(Div4Processor.class.getSimpleName(), unwrappedClassName(d030402ProcList.get(4)));
    Assert.assertEquals(P2Processor.class.getSimpleName(), unwrappedClassName(d030402ProcList.get(5)));
    Assert.assertEquals(P4Processor.class.getSimpleName(), unwrappedClassName(d030402ProcList.get(6)));
    List<IElementProcessor> d020403ProcList = new ArrayList<IElementProcessor>(combineDialects(dialect02, dialect04, dialect03));
    Assert.assertEquals(P3Processor.class.getSimpleName(), unwrappedClassName(d020403ProcList.get(0)));
    Assert.assertEquals(Span3Processor.class.getSimpleName(), unwrappedClassName(d020403ProcList.get(1)));
    Assert.assertEquals(Span4Processor.class.getSimpleName(), unwrappedClassName(d020403ProcList.get(2)));
    Assert.assertEquals(Div2Processor.class.getSimpleName(), unwrappedClassName(d020403ProcList.get(3)));
    Assert.assertEquals(Div4Processor.class.getSimpleName(), unwrappedClassName(d020403ProcList.get(4)));
    Assert.assertEquals(P2Processor.class.getSimpleName(), unwrappedClassName(d020403ProcList.get(5)));
    Assert.assertEquals(P4Processor.class.getSimpleName(), unwrappedClassName(d020403ProcList.get(6)));
}
Also used : Dialect04(org.thymeleaf.dialect.dialectordering.Dialect04) Span4Processor(org.thymeleaf.dialect.dialectordering.Span4Processor) P3Processor(org.thymeleaf.dialect.dialectordering.P3Processor) Dialect02(org.thymeleaf.dialect.dialectordering.Dialect02) P1Processor(org.thymeleaf.dialect.dialectordering.P1Processor) Dialect03(org.thymeleaf.dialect.dialectordering.Dialect03) Div1Processor(org.thymeleaf.dialect.dialectordering.Div1Processor) ArrayList(java.util.ArrayList) Dialect01(org.thymeleaf.dialect.dialectordering.Dialect01) IProcessor(org.thymeleaf.processor.IProcessor) Span3Processor(org.thymeleaf.dialect.dialectordering.Span3Processor) Div2Processor(org.thymeleaf.dialect.dialectordering.Div2Processor) IElementProcessor(org.thymeleaf.processor.element.IElementProcessor) P2Processor(org.thymeleaf.dialect.dialectordering.P2Processor) P4Processor(org.thymeleaf.dialect.dialectordering.P4Processor) Div4Processor(org.thymeleaf.dialect.dialectordering.Div4Processor) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 Dialect01 (org.thymeleaf.dialect.dialectordering.Dialect01)1 Dialect02 (org.thymeleaf.dialect.dialectordering.Dialect02)1 Dialect03 (org.thymeleaf.dialect.dialectordering.Dialect03)1 Dialect04 (org.thymeleaf.dialect.dialectordering.Dialect04)1 Div1Processor (org.thymeleaf.dialect.dialectordering.Div1Processor)1 Div2Processor (org.thymeleaf.dialect.dialectordering.Div2Processor)1 Div4Processor (org.thymeleaf.dialect.dialectordering.Div4Processor)1 P1Processor (org.thymeleaf.dialect.dialectordering.P1Processor)1 P2Processor (org.thymeleaf.dialect.dialectordering.P2Processor)1 P3Processor (org.thymeleaf.dialect.dialectordering.P3Processor)1 P4Processor (org.thymeleaf.dialect.dialectordering.P4Processor)1 Span3Processor (org.thymeleaf.dialect.dialectordering.Span3Processor)1 Span4Processor (org.thymeleaf.dialect.dialectordering.Span4Processor)1 IProcessor (org.thymeleaf.processor.IProcessor)1 IElementProcessor (org.thymeleaf.processor.element.IElementProcessor)1