### Question:
JcrValue implements Value, org.modeshape.jcr.api.Value { public Calendar getDate() throws ValueFormatException { try { Calendar convertedValue = valueFactories.getDateFactory().create(value).toCalendar(); return convertedValue; } catch (RuntimeException error) { throw createValueFormatException(Calendar.class); } } JcrValue( ValueFactories valueFactories,
              SessionCache sessionCache,
              int type,
              Object value );   JcrValue( ValueFactories valueFactories,
              SessionCache sessionCache,
              Value value ); boolean getBoolean(); Calendar getDate(); @Override BigDecimal getDecimal(); double getDouble(); long getLong(); InputStream getStream(); javax.jcr.Binary getBinary(); String getString(); int getType(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString();  }### Answer:
@Test( expected = ValueFormatException.class ) public void shouldNotProvideDateForBoolean() throws Exception { value.getDate(); }
@Test public void shouldProvideDateForDate() throws Exception { Date date = new Date(); assertThat(new JcrValue(factories, cache, PropertyType.DATE, date).getDate().getTime(), is(date)); }
@Test public void shouldProvideDateForDouble() throws Exception { Calendar expectedValue = Calendar.getInstance(); expectedValue.setTime(new Date(0L)); assertThat(new JcrValue(factories, cache, PropertyType.DOUBLE, 0.0).getDate().getTimeInMillis(), is(expectedValue.getTimeInMillis())); }
@Test public void shouldProvideDateForLong() throws Exception { Calendar expectedValue = Calendar.getInstance(); expectedValue.setTime(new Date(0L)); assertThat(new JcrValue(factories, cache, PropertyType.LONG, 0L).getDate().getTimeInMillis(), is(expectedValue.getTimeInMillis())); }
@Test public void shouldProvideDateForString() throws Exception { assertThat(new JcrValue(factories, cache, PropertyType.STRING, "2008").getDate(), notNullValue()); }
@Test( expected = ValueFormatException.class ) public void shouldNotProvideDateForInvalidString() throws Exception { new JcrValue(factories, cache, PropertyType.STRING, "true").getDate(); }
@Test( expected = ValueFormatException.class ) public void shouldNotProvideDateForUuid() throws Exception { new JcrValue(factories, cache, PropertyType.STRING, UUID.randomUUID()).getDate(); }