You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by rd...@apache.org on 2013/12/08 22:26:17 UTC
svn commit: r1549289 -
/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java
Author: rdonkin
Date: Sun Dec 8 21:26:16 2013
New Revision: 1549289
URL: http://svn.apache.org/r1549289
Log:
Format Code.
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java
Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java?rev=1549289&r1=1549288&r2=1549289&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java (original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/report/xml/MockXmlWriter.java Sun Dec 8 21:26:16 2013
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the *
* specific language governing permissions and limitations *
* under the License. *
- */
+ */
package org.apache.rat.report.xml;
import java.io.IOException;
@@ -26,101 +26,113 @@ import org.apache.rat.report.xml.writer.
public class MockXmlWriter implements IXmlWriter {
- public final List<Object> calls;
-
- public MockXmlWriter() {
- calls = new ArrayList<Object>();
- }
-
- public IXmlWriter attribute(CharSequence name, CharSequence value)
- throws IOException {
- calls.add(new Attribute(name, value));
- return this;
- }
-
- public IXmlWriter closeDocument() throws IOException {
- calls.add(new CloseDocument());
- return this;
- }
-
- public IXmlWriter closeElement() throws IOException {
- calls.add(new CloseElement());
- return this;
- }
-
- public IXmlWriter content(CharSequence content) throws IOException {
- calls.add(new Content(content));
- return this;
- }
-
- public IXmlWriter openElement(CharSequence elementName) throws IOException {
- calls.add(new OpenElement(elementName));
- return this;
- }
-
- public IXmlWriter startDocument() throws IOException {
- calls.add(new StartDocument());
- return this;
- }
-
- public boolean isCloseElement(int index) {
- boolean result = false;
- final Object call = calls.get(index);
- result = call instanceof CloseElement;
- return result;
- }
-
- public boolean isContent(String content, int index) {
- boolean result = false;
- final Object call = calls.get(index);
- if (call instanceof Content) {
- Content contentCall = (Content) call;
- result = content.equals(contentCall.content);
- }
- return result;
- }
-
- public boolean isOpenElement(String name, int index) {
- boolean result = false;
- final Object call = calls.get(index);
- if (call instanceof OpenElement) {
- OpenElement openElement = (OpenElement) call;
- result = name.equals(openElement.elementName);
- }
- return result;
- }
-
- public boolean isAttribute(String name, String value, int index) {
- boolean result = false;
- final Object call = calls.get(index);
- if (call instanceof Attribute) {
- Attribute attribute = (Attribute) call;
- result = name.equals(attribute.name) && value.equals(attribute.value);
- }
- return result;
- }
-
- public class StartDocument {}
- public class CloseDocument {}
- public class CloseElement {}
- public class OpenElement {
- public final CharSequence elementName;
- private OpenElement(CharSequence elementName) {
- this.elementName = elementName;
- }
- }
- public class Content {
- public final CharSequence content;
- private Content(CharSequence content) {
- this.content = content;
- }
- }
- public class Attribute {
- public final CharSequence name;
- public final CharSequence value;
- private Attribute(CharSequence name, CharSequence value) {
- this.name = name;
- this.value = value;
- }
- }
+ public final List<Object> calls;
+
+ public MockXmlWriter() {
+ calls = new ArrayList<Object>();
+ }
+
+ public IXmlWriter attribute(CharSequence name, CharSequence value)
+ throws IOException {
+ calls.add(new Attribute(name, value));
+ return this;
+ }
+
+ public IXmlWriter closeDocument() throws IOException {
+ calls.add(new CloseDocument());
+ return this;
+ }
+
+ public IXmlWriter closeElement() throws IOException {
+ calls.add(new CloseElement());
+ return this;
+ }
+
+ public IXmlWriter content(CharSequence content) throws IOException {
+ calls.add(new Content(content));
+ return this;
+ }
+
+ public IXmlWriter openElement(CharSequence elementName) throws IOException {
+ calls.add(new OpenElement(elementName));
+ return this;
+ }
+
+ public IXmlWriter startDocument() throws IOException {
+ calls.add(new StartDocument());
+ return this;
+ }
+
+ public boolean isCloseElement(int index) {
+ boolean result = false;
+ final Object call = calls.get(index);
+ result = call instanceof CloseElement;
+ return result;
+ }
+
+ public boolean isContent(String content, int index) {
+ boolean result = false;
+ final Object call = calls.get(index);
+ if (call instanceof Content) {
+ Content contentCall = (Content) call;
+ result = content.equals(contentCall.content);
+ }
+ return result;
+ }
+
+ public boolean isOpenElement(String name, int index) {
+ boolean result = false;
+ final Object call = calls.get(index);
+ if (call instanceof OpenElement) {
+ OpenElement openElement = (OpenElement) call;
+ result = name.equals(openElement.elementName);
+ }
+ return result;
+ }
+
+ public boolean isAttribute(String name, String value, int index) {
+ boolean result = false;
+ final Object call = calls.get(index);
+ if (call instanceof Attribute) {
+ Attribute attribute = (Attribute) call;
+ result = name.equals(attribute.name)
+ && value.equals(attribute.value);
+ }
+ return result;
+ }
+
+ public class StartDocument {
+ }
+
+ public class CloseDocument {
+ }
+
+ public class CloseElement {
+ }
+
+ public class OpenElement {
+ public final CharSequence elementName;
+
+ private OpenElement(CharSequence elementName) {
+ this.elementName = elementName;
+ }
+ }
+
+ public class Content {
+ public final CharSequence content;
+
+ private Content(CharSequence content) {
+ this.content = content;
+ }
+ }
+
+ public class Attribute {
+ public final CharSequence name;
+ public final CharSequence value;
+
+ private Attribute(CharSequence name, CharSequence value) {
+ this.name = name;
+ this.value = value;
+ }
+ }
}