// Path: src/main/java/com/ottogroup/bi/streaming/operator/json/JsonContentReference.java
// public class JsonContentReference implements Serializable {
// 
// 	private static final long serialVersionUID = -5075723737186875253L;
// 
// 	private String[] path = null;
// 	private JsonContentType contentType = null;
// 	private String conversionPattern = null;
// 	/** enforce strict evaluation and require the field to be present */
// 	private boolean required = false;
// 	
// 	public JsonContentReference() {		
// 	}
// 	
// 	public JsonContentReference(final String[] path, final JsonContentType contentType) {
// 		this(path, contentType, false);
// 	}
// 	
// 	public JsonContentReference(final String[] path, final JsonContentType contentType, final boolean required) {
// 		this.path = path;
// 		this.contentType = contentType;
// 		this.required = required;
// 	}
// 	
// 	public JsonContentReference(final String[] path, final JsonContentType contentType, final String conversionPattern) {
// 		this.path = path;
// 		this.contentType = contentType;
// 		this.conversionPattern = conversionPattern;
// 	}
// 	
// 	public JsonContentReference(final String[] path, final JsonContentType contentType, final String conversionPattern, final boolean required) {
// 		this.path = path;
// 		this.contentType = contentType;
// 		this.conversionPattern = conversionPattern;
// 		this.required = required;
// 	}
// 
// 	public String[] getPath() {
// 		return path;
// 	}
// 
// 	public void setPath(String[] path) {
// 		this.path = path;
// 	}
// 
// 	public JsonContentType getContentType() {
// 		return contentType;
// 	}
// 
// 	public void setContentType(JsonContentType contentType) {
// 		this.contentType = contentType;
// 	}
// 
// 	public String getConversionPattern() {
// 		return conversionPattern;
// 	}
// 
// 	public void setConversionPattern(String conversionPattern) {
// 		this.conversionPattern = conversionPattern;
// 	}
// 
// 	public boolean isRequired() {
// 		return required;
// 	}
// 
// 	public void setRequired(boolean required) {
// 		this.required = required;
// 	}
// 	
// 	
// }
// 
// Path: src/main/java/com/ottogroup/bi/streaming/operator/json/JsonContentType.java
// public enum JsonContentType implements Serializable {
// 	STRING, INTEGER, DOUBLE, TIMESTAMP, BOOLEAN 
// }


import java.text.SimpleDateFormat;
import org.apache.sling.commons.json.JSONObject;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.StringDescription;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import com.ottogroup.bi.streaming.operator.json.JsonContentReference;
import com.ottogroup.bi.streaming.operator.json.JsonContentType;
	 */
	@Test
	public void testMatchesSafely_withValidTimestampValue() throws Exception {
		final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		StringDescription descr = new StringDescription();
		JSONObject input = new JSONObject("{\"path\":\"2016-04-25\"}");
		Assert.assertTrue(new JSONFieldContentMatcher(new JsonContentReference(new String[]{"path"}, JsonContentType.TIMESTAMP, "yyyy-MM-dd", true), Matchers.is(sdf.parse("2016-04-25"))).matchesSafely(input, descr));
		Assert.assertTrue(descr.toString().isEmpty());
	}
	
	/**
	 * Test case for {@link JSONFieldContentMatcher#matchesSafely(JSONObject, Description)} being provided a valid
	 * {@link JSONObject} and a reference to an existing field which is expected to hold a string but does not exist 
	 */
	@Test
	public void testMatchesSafely_withNonExistingStringRef() throws Exception {
		StringDescription descr = new StringDescription();
		JSONObject input = new JSONObject("{\"path\":\"2016-04-25\"}");
		Assert.assertFalse(new JSONFieldContentMatcher(new JsonContentReference(new String[]{"pathToValue"}, JsonContentType.STRING, true), Matchers.is("2016-04-25")).matchesSafely(input, descr));
		Assert.assertEquals("[content extraction failed: Path element 'pathToValue' does not exist for provided JSON object]", descr.toString());
	}
	
	/**
	 * Test case for {@link JSONFieldContentMatcher#matchesSafely(JSONObject, Description)} being provided a valid
	 * {@link JSONObject} and a reference to an existing field which is expected to hold a string but that one does not match 
	 */
	@Test
	public void testMatchesSafely_withNonMatchingStringAtRef() throws Exception {
		StringDescription descr = new StringDescription();
		JSONObject input = new JSONObject("{\"path\":\"2016-04-25\"}");
// Path: src/main/java/com/ottogroup/bi/streaming/operator/json/JsonContentReference.java
// public class JsonContentReference implements Serializable {
// 
// 	private static final long serialVersionUID = -5075723737186875253L;
// 
// 	private String[] path = null;
// 	private JsonContentType contentType = null;
// 	private String conversionPattern = null;
// 	/** enforce strict evaluation and require the field to be present */
// 	private boolean required = false;
// 	
// 	public JsonContentReference() {		
// 	}
// 	
// 	public JsonContentReference(final String[] path, final JsonContentType contentType) {
// 		this(path, contentType, false);
// 	}
// 	
// 	public JsonContentReference(final String[] path, final JsonContentType contentType, final boolean required) {
// 		this.path = path;
// 		this.contentType = contentType;
// 		this.required = required;
// 	}
// 	
// 	public JsonContentReference(final String[] path, final JsonContentType contentType, final String conversionPattern) {
// 		this.path = path;
// 		this.contentType = contentType;
// 		this.conversionPattern = conversionPattern;
// 	}
// 	
// 	public JsonContentReference(final String[] path, final JsonContentType contentType, final String conversionPattern, final boolean required) {
// 		this.path = path;
// 		this.contentType = contentType;
// 		this.conversionPattern = conversionPattern;
// 		this.required = required;
// 	}
// 
// 	public String[] getPath() {
// 		return path;
// 	}
// 
// 	public void setPath(String[] path) {
// 		this.path = path;
// 	}
// 
// 	public JsonContentType getContentType() {
// 		return contentType;
// 	}
// 
// 	public void setContentType(JsonContentType contentType) {
// 		this.contentType = contentType;
// 	}
// 
// 	public String getConversionPattern() {
// 		return conversionPattern;
// 	}
// 
// 	public void setConversionPattern(String conversionPattern) {
// 		this.conversionPattern = conversionPattern;
// 	}
// 
// 	public boolean isRequired() {
// 		return required;
// 	}
// 
// 	public void setRequired(boolean required) {
// 		this.required = required;
// 	}
// 	
// 	
// }
// 
// Path: src/main/java/com/ottogroup/bi/streaming/operator/json/JsonContentType.java
// public enum JsonContentType implements Serializable {
// 	STRING, INTEGER, DOUBLE, TIMESTAMP, BOOLEAN 
// }


// Path: src/test/java/com/ottogroup/bi/streaming/testing/JSONFieldContentMatcherTest.java
import java.text.SimpleDateFormat;
import org.apache.sling.commons.json.JSONObject;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.StringDescription;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import com.ottogroup.bi.streaming.operator.json.JsonContentReference;
import com.ottogroup.bi.streaming.operator.json.JsonContentType;

	 */
	@Test
	public void testMatchesSafely_withValidTimestampValue() throws Exception {
		final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		StringDescription descr = new StringDescription();
		JSONObject input = new JSONObject("{\"path\":\"2016-04-25\"}");
		Assert.assertTrue(new JSONFieldContentMatcher(new JsonContentReference(new String[]{"path"}, JsonContentType.TIMESTAMP, "yyyy-MM-dd", true), Matchers.is(sdf.parse("2016-04-25"))).matchesSafely(input, descr));
		Assert.assertTrue(descr.toString().isEmpty());
	}
	
	/**
	 * Test case for {@link JSONFieldContentMatcher#matchesSafely(JSONObject, Description)} being provided a valid
	 * {@link JSONObject} and a reference to an existing field which is expected to hold a string but does not exist 
	 */
	@Test
	public void testMatchesSafely_withNonExistingStringRef() throws Exception {
		StringDescription descr = new StringDescription();
		JSONObject input = new JSONObject("{\"path\":\"2016-04-25\"}");
		Assert.assertFalse(new JSONFieldContentMatcher(new JsonContentReference(new String[]{"pathToValue"}, JsonContentType.STRING, true), Matchers.is("2016-04-25")).matchesSafely(input, descr));
		Assert.assertEquals("[content extraction failed: Path element 'pathToValue' does not exist for provided JSON object]", descr.toString());
	}
	
	/**
	 * Test case for {@link JSONFieldContentMatcher#matchesSafely(JSONObject, Description)} being provided a valid
	 * {@link JSONObject} and a reference to an existing field which is expected to hold a string but that one does not match 
	 */
	@Test
	public void testMatchesSafely_withNonMatchingStringAtRef() throws Exception {
		StringDescription descr = new StringDescription();
		JSONObject input = new JSONObject("{\"path\":\"2016-04-25\"}");
		Assert.assertFalse(new JSONFieldContentMatcher(new JsonContentReference(new String[]{"path"}, JsonContentType.STRING, true), Matchers.is("2016-04-26")).matchesSafely(input, descr));