/*
 * Copyright 2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.opentest4j;

/**
 * {@code AssertionFailedError} is an <em>initial draft</em> for a common
 * base class for test-related {@link AssertionError AssertionErrors}.
 *
 * <p><strong>WARNING</strong>: this is a <em>work in progress</em> and
 * is therefore guaranteed to undergo heavy revisions in the near future
 * based on community feedback.
 *
 * @author Sam Brannen
 * @author Marc Phillip
 * @since 1.0
 */
public class AssertionFailedError extends AssertionError {

	private static final long serialVersionUID = 3170879295749989795L;

	/**
	 * <em>Undefined</em> object, used to differentiate between a {@code null}
	 * default value and a user-supplied {@code null} value.
	 */
	private static final Object UNDEFINED = new Object();

	private final Object expected;

	private final Object actual;

	public AssertionFailedError() {
		this((String) null);
	}

	public AssertionFailedError(String message) {
		this(message, UNDEFINED, UNDEFINED);
	}

	public AssertionFailedError(String message, Object expected, Object actual) {
		this(message, expected, actual, null);
	}

	public AssertionFailedError(String message, Throwable cause) {
		this(message, UNDEFINED, UNDEFINED, cause);
	}

	public AssertionFailedError(String message, Object expected, Object actual, Throwable cause) {
		super(message, cause);
		this.expected = expected;
		this.actual = actual;
	}

	public boolean isExpectedDefined() {
		return (this.expected != UNDEFINED);
	}

	public boolean isActualDefined() {
		return (this.actual != UNDEFINED);
	}

	public Object getExpected() {
		return (this.expected == UNDEFINED ? null : this.expected);
	}

	public Object getActual() {
		return (this.actual == UNDEFINED ? null : this.actual);
	}

}

/*
 * Copyright 2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.opentest4j;

/**
 * {@code AssertionFailedError} is an <em>initial draft</em> for a common
 * base class for test-related {@link AssertionError AssertionErrors}.
 *
 * <p><strong>WARNING</strong>: this is a <em>work in progress</em> and
 * is therefore guaranteed to undergo heavy revisions in the near future
 * based on community feedback.
 *
 * @author Sam Brannen
 * @author Marc Philipp
 * @since 1.0
 */
public class AssertionFailedError extends AssertionError {

	private static final long serialVersionUID = 3170879295749989795L;

	/**
	 * <em>Undefined</em> object, used to differentiate between a {@code null}
	 * default value and a user-supplied {@code null} value.
	 */
	private static final Object UNDEFINED = new Object();

	private final Object expected;

	private final Object actual;

	public AssertionFailedError() {
		this((String) null);
	}

	public AssertionFailedError(String message) {
		this(message, UNDEFINED, UNDEFINED);
	}

	public AssertionFailedError(String message, Object expected, Object actual) {
		this(message, expected, actual, null);
	}

	public AssertionFailedError(String message, Throwable cause) {
		this(message, UNDEFINED, UNDEFINED, cause);
	}

	public AssertionFailedError(String message, Object expected, Object actual, Throwable cause) {
		super(message, cause);
		this.expected = expected;
		this.actual = actual;
	}

	public boolean isExpectedDefined() {
		return (this.expected != UNDEFINED);
	}

	public boolean isActualDefined() {
		return (this.actual != UNDEFINED);
	}

	public Object getExpected() {
		return (this.expected == UNDEFINED ? null : this.expected);
	}

	public Object getActual() {
		return (this.actual == UNDEFINED ? null : this.actual);
	}

}

Fix one additional spelling of my name