-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SUREFIRE-1556] fail fast on empty element names (#11)
* fail fast on empty element names
- Loading branch information
Showing
3 changed files
with
59 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,8 @@ | |
*/ | ||
|
||
import java.io.IOException; | ||
|
||
import javax.swing.text.html.HTML; | ||
import java.io.StringWriter; | ||
import javax.swing.text.html.HTML; | ||
|
||
import org.apache.maven.shared.utils.StringUtils; | ||
import org.junit.Assert; | ||
|
@@ -32,13 +31,25 @@ | |
* Test of {@link PrettyPrintXMLWriter} | ||
* | ||
* @author <a href="mailto:[email protected]">Vincent Siveton</a> | ||
* | ||
*/ | ||
public class PrettyPrintXmlWriterTest | ||
{ | ||
private StringWriter w = new StringWriter(); | ||
private StringWriter w = new StringWriter();; | ||
private PrettyPrintXMLWriter writer = new PrettyPrintXMLWriter( w ); | ||
|
||
@Test | ||
public void testNoStartTag() throws IOException | ||
{ | ||
|
||
try { | ||
writer.startElement( "" ); | ||
Assert.fail( "allowed empty name" ); | ||
} catch ( IllegalArgumentException ex ) { | ||
Assert.assertEquals( "Element name cannot be empty", ex.getMessage() ); | ||
} | ||
|
||
} | ||
|
||
@Test | ||
public void testDefaultPrettyPrintXMLWriter() throws IOException | ||
{ | ||
|