@Override
    public <T> Optional<T> valueAs(Class<T> type) {
        checkNotNull(type);

        return id.lastComponentAs(type);
    }
@Test
    public void testValueOfRoot() {
        DiscreteResource resource = Resource.ROOT;

        assertThat(resource.valueAs(Object.class), is(Optional.empty()));
    }