use of org.thymeleaf.dialect.dialectordering.Dialect02 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)));
}
Aggregations