### Question:
JcrValue implements Value, org.modeshape.jcr.api.Value { public long getLong() throws ValueFormatException { try { long convertedValue = valueFactories.getLongFactory().create(value); return convertedValue; } catch (RuntimeException error) { throw createValueFormatException(long.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 shouldNotProvideLongForBoolean() throws Exception { value.getLong(); }
@Test public void shouldProvideLongForDate() throws Exception { Date date = new Date(); assertThat(new JcrValue(factories, cache, PropertyType.DATE, date).getLong(), is(date.getTime())); }
@Test public void shouldProvideLongForDouble() throws Exception { assertThat(new JcrValue(factories, cache, PropertyType.DOUBLE, 1.0).getLong(), is(1L)); assertThat(new JcrValue(factories, cache, PropertyType.DOUBLE, Double.MAX_VALUE).getLong(), is(Long.MAX_VALUE)); }
@Test public void shouldProvideLongForLong() throws Exception { assertThat(new JcrValue(factories, cache, PropertyType.LONG, 1L).getLong(), is(1L)); }
@Test public void shouldProvideLongForString() throws Exception { assertThat(new JcrValue(factories, cache, PropertyType.STRING, "1").getLong(), is(1L)); }
@Test( expected = ValueFormatException.class ) public void shouldNotProvideLongForInvalidString() throws Exception { new JcrValue(factories, cache, PropertyType.STRING, "true").getLong(); }
@Test( expected = ValueFormatException.class ) public void shouldNotProvideLongForUuid() throws Exception { new JcrValue(factories, cache, PropertyType.STRING, UUID.randomUUID()).getLong(); }