1 package org.apache.maven.doxia.module.fo;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import javax.swing.text.MutableAttributeSet;
23 import javax.swing.text.SimpleAttributeSet;
24
25 import junit.framework.TestCase;
26
27
28
29
30
31
32 public class FoConfigurationTest
33 extends TestCase
34 {
35
36
37 public void testGetAttributeString()
38 {
39 FoConfiguration config = new FoConfiguration();
40
41 assertEquals( "Null attribute ID should return empty string!", "", config.getAttributeString( null ) );
42
43 assertEquals( "Non existent attribute ID should return empty string!", "",
44 config.getAttributeString( "a.dummy.attribute" ) );
45
46 assertEquals( "Wrong attributes returned for body.pre!", " font-family=\"monospace\" font-size=\"10pt\"",
47 config.getAttributeString( "body.pre" ) );
48 }
49
50
51 public void testGetAttributeSet()
52 {
53 FoConfiguration config = new FoConfiguration();
54
55 assertNull( "Null attribute ID should return null AttributeSet!", config.getAttributeSet( null ) );
56
57 assertNull( "Empty attribute ID should return null AttributeSet!", config.getAttributeSet( "" ) );
58
59 assertNull( "Non existent attribute ID should return null AttributeSet!",
60 config.getAttributeSet( "a.dummy.attribute" ) );
61
62 MutableAttributeSet expected = new SimpleAttributeSet();
63 expected.addAttribute( "font-size", "10pt" );
64 expected.addAttribute( "font-family", "monospace" );
65 MutableAttributeSet actual = config.getAttributeSet( "body.pre" );
66
67 assertTrue( "Wrong AttributeSet returned for body.pre!", expected.isEqual( actual ) );
68 }
69
70 }