1919
2020package org .apache .fop .render .intermediate ;
2121
22-
2322import org .junit .Before ;
2423import org .junit .Test ;
2524import org .mockito .InOrder ;
2827import org .xml .sax .SAXException ;
2928import org .xml .sax .helpers .AttributesImpl ;
3029
30+ import static org .mockito .ArgumentMatchers .any ;
31+ import static org .mockito .ArgumentMatchers .eq ;
3132import static org .mockito .Mockito .inOrder ;
3233import static org .mockito .Mockito .mock ;
3334import static org .mockito .Mockito .verify ;
3435
36+ import org .apache .fop .fo .FOElementMapping ;
3537import org .apache .fop .render .intermediate .IFStructureTreeBuilder .SAXEventRecorder ;
3638import org .apache .fop .util .XMLUtil ;
3739
4042 */
4143public class SAXEventRecorderTestCase {
4244
43- private static final String URI = "http://www.example.com/" ;
45+ private static final String URI = FOElementMapping . URI ;
4446
4547 private SAXEventRecorder sut ;
4648
@@ -52,19 +54,19 @@ public void setUp() {
5254 @ Test
5355 public void testStartEvent () throws SAXException {
5456 final String localName = "element" ;
55- final String qName = "prefix :" + localName ;
57+ final String qName = "fo :" + localName ;
5658 final Attributes attributes = new AttributesImpl ();
5759
5860 sut .startElement (URI , localName , qName , attributes );
5961 ContentHandler handler = mock (ContentHandler .class );
6062 sut .replay (handler );
61- verify (handler ).startElement (URI , localName , qName , attributes );
63+ verify (handler ).startElement (eq ( URI ), eq ( localName ), eq ( qName ), any ( Attributes . class ) );
6264 }
6365
6466 @ Test
6567 public void testEndEvent () throws SAXException {
6668 final String localName = "element" ;
67- final String qName = "prefix :" + localName ;
69+ final String qName = "fo :" + localName ;
6870 sut .endElement (URI , localName , qName );
6971 ContentHandler handler = mock (ContentHandler .class );
7072 sut .replay (handler );
@@ -94,14 +96,14 @@ public void testEndPrefixMapping() throws SAXException {
9496 @ Test
9597 public void completeTest () throws SAXException {
9698 final String localName1 = "element" ;
97- final String qName1 = "prefix :" + localName1 ;
99+ final String qName1 = "fo :" + localName1 ;
98100 final Attributes attributes1 = createAttributes (URI , localName1 , qName1 , "value-1" );
99101 final String localName2 = "element2" ;
100- final String qName2 = "prefix :" + localName2 ;
102+ final String qName2 = "fo :" + localName2 ;
101103 final Attributes attributes2 = createAttributes (URI , localName2 , qName2 , "value-2" );
102104 final ContentHandler handler = mock (ContentHandler .class );
103- final String extensionUrl = "http://www.example.com/extension" ;
104- final String extensionPrefix = "ext " ;
105+ final String extensionUrl = URI ;
106+ final String extensionPrefix = "fo " ;
105107
106108 sut .startPrefixMapping (extensionPrefix , extensionUrl );
107109 sut .startElement (URI , localName1 , qName1 , attributes1 );
@@ -114,8 +116,8 @@ public void completeTest() throws SAXException {
114116
115117 InOrder inOrder = inOrder (handler );
116118 inOrder .verify (handler ).startPrefixMapping (extensionPrefix , extensionUrl );
117- inOrder .verify (handler ).startElement (URI , localName1 , qName1 , attributes1 );
118- inOrder .verify (handler ).startElement (URI , localName2 , qName2 , attributes2 );
119+ inOrder .verify (handler ).startElement (eq ( URI ), eq ( localName1 ), eq ( qName1 ), any ( Attributes . class ) );
120+ inOrder .verify (handler ).startElement (eq ( URI ), eq ( localName2 ), eq ( qName2 ), any ( Attributes . class ) );
119121 inOrder .verify (handler ).endElement (URI , localName2 , qName2 );
120122 inOrder .verify (handler ).endElement (URI , localName1 , qName1 );
121123 inOrder .verify (handler ).endPrefixMapping (extensionPrefix );
0 commit comments