@Theory public void theoryUndefinedHaveEmptyListOfChildren(String path) throws Exception { Resource res = getResource(path); assumeThat(res, is(undefined())); Collection<Resource> result = res.list(); assertThat(result, empty()); }
@Theory public void theoryUndefinedHaveIstreamAndBecomeResource(String path) throws Exception { Resource res = getResource(path); assumeThat(res, is(undefined())); try (InputStream result = res.in()) { assertThat(result, notNullValue()); assertThat(res, is(resource())); } }
@Theory public void theoryUndefinedHaveOstreamAndBecomeResource(String path) throws Exception { Resource res = getResource(path); assumeThat(res, is(undefined())); try (OutputStream result = res.out()) { assertThat(result, notNullValue()); assertThat(res, is(resource())); } }
@Theory public void theoryDeletedResourcesAreUndefined(String path) throws Exception { Resource res = getResource(path); assumeThat(res, resource()); assertThat(res.delete(), is(true)); assertThat(res, undefined()); }
@Theory public void theoryRenamedAreUndefined(String path) throws Exception { Resource res = getResource(path); assumeThat(res, defined()); Resource target = getUndefined(); assertThat(res.renameTo(target), is(true)); assertThat(res, undefined()); }
@Theory public void theoryUndefinedHaveEmptyListOfChildren(String path) throws Exception { Resource res = getResource(path); assumeThat(res, is(undefined())); Collection<Resource> result = res.list(); assertThat(result, empty()); }
@Theory public void theoryUndefinedHaveIstreamAndBecomeResource(String path) throws Exception { Resource res = getResource(path); assumeThat(res, is(undefined())); try (InputStream result = res.in()) { assertThat(result, notNullValue()); assertThat(res, is(resource())); } }
@Theory public void theoryUndefinedHaveOstreamAndBecomeResource(String path) throws Exception { Resource res = getResource(path); assumeThat(res, is(undefined())); try (OutputStream result = res.out()) { assertThat(result, notNullValue()); assertThat(res, is(resource())); } }
@Theory public void theoryDeletedResourcesAreUndefined(String path) throws Exception { Resource res = getResource(path); assumeThat(res, resource()); assertThat(res.delete(), is(true)); assertThat(res, undefined()); }
@Test public void testBasicUndefinedQuery() throws Exception { standardData(); JDBCResourceStoreProperties config = getConfig(true, false); JDBCResourceStore store = new JDBCResourceStore(support.getDataSource(), config); store.setLockProvider(new NullLockProvider()); Resource r = store.get("DoesntExist"); assertThat(r, not(nullValue())); assertThat(r, undefined()); }
@Theory public void theoryRenamedAreUndefined(String path) throws Exception { Resource res = getResource(path); assumeThat(res, defined()); Resource target = getUndefined(); assertThat(res.renameTo(target), is(true)); assertThat(res, undefined()); }