package uk.co.datumedge.hamcrest.json;

import org.hamcrest.Description;
import org.hamcrest.SelfDescribing;

/**
 * Models the result of a comparison between two JSON documents.
 */
public final class JSONComparisonResult implements SelfDescribing {
	private static final JSONComparisonResult PASSED = new JSONComparisonResult();
	private final boolean passed;
	private final SelfDescribing description;

	private JSONComparisonResult() {
		this.passed = true;
		this.description = new SelfDescribing() {
			@Override public void describeTo(Description description) { }
		};
	}

	public JSONComparisonResult(SelfDescribing description) {
		this.passed = false;
		this.description = description;
	}

	@Override
	public void describeTo(Description description) {
		description.appendDescriptionOf(this.description);
	}

	public boolean failed() {
		return !passed;
	}

	public boolean passed() {
		return passed;
	}

	static JSONComparisonResult comparisonPassed() {
		return PASSED;
	}

	static JSONComparisonResult comparisonFailed(final String message) {
		return new JSONComparisonResult(new SelfDescribing() {
			@Override
			public void describeTo(Description description) {
				description.appendText(message).toString();
			}
		});
	}
}

@@ -982,263 +982,7 @@
 ;%0A%09%7D
-%0A%0A%09static JSONComparisonResult comparisonFailed(final String message) %7B%0A%09%09return new JSONComparisonResult(new SelfDescribing() %7B%0A%09%09%09@Override%0A%09%09%09public void describeTo(Description description) %7B%0A%09%09%09%09description.appendText(message).toString();%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D
 %0A%7D%0A

remove dead method