@Test public void testResolverSnapshotResolver$resolveSnapshot$engineFailure() throws Exception { final URI base = URI.create("http: final ResourceId resourceId = ResourceId.createId(NamingScheme.getDefault().name("name"),"template"); new Expectations() {{ snapshot.name();result=resourceId.name(); snapshot.templateId();result=resourceId.templateId(); }}; new MockUp<ApplicationEngine>() { @Mock public ApplicationEngine engine() throws ApplicationEngineException { throw new ApplicationEngineException("FAILURE"); } }; CoreRuntimeDelegate sut=new CoreRuntimeDelegate(); ResourceSnapshotResolver resolver = sut.createResourceResolver(base, session); try { assertThat(resolver.resolve(snapshot),nullValue()); fail("Should not resolve snapshot if engine fails"); } catch (SnapshotResolutionException e) { assertThat(e.getMessage(),equalTo("Could not resolve endpoint for resource '"+resourceId+"'")); } }
@Override public ResourceSnapshotResolver createResourceResolver(URI canonicalBase, ReadSession session) { return new DefaultSnapshotResolver(canonicalBase,session); }
CoreRuntimeDelegate extends RuntimeDelegate { @Override public ResourceSnapshotResolver createResourceResolver(URI canonicalBase, ReadSession session) { return new DefaultSnapshotResolver(canonicalBase,session); } }
CoreRuntimeDelegate extends RuntimeDelegate { @Override public ResourceSnapshotResolver createResourceResolver(URI canonicalBase, ReadSession session) { return new DefaultSnapshotResolver(canonicalBase,session); } CoreRuntimeDelegate(); }
CoreRuntimeDelegate extends RuntimeDelegate { @Override public ResourceSnapshotResolver createResourceResolver(URI canonicalBase, ReadSession session) { return new DefaultSnapshotResolver(canonicalBase,session); } CoreRuntimeDelegate(); @Override boolean isOffline(); @Override WriteSession createSession(); @Override ResourceSnapshotResolver createResourceResolver(URI canonicalBase, ReadSession session); @Override void registerShutdownListener(ShutdownListener listener); }
CoreRuntimeDelegate extends RuntimeDelegate { @Override public ResourceSnapshotResolver createResourceResolver(URI canonicalBase, ReadSession session) { return new DefaultSnapshotResolver(canonicalBase,session); } CoreRuntimeDelegate(); @Override boolean isOffline(); @Override WriteSession createSession(); @Override ResourceSnapshotResolver createResourceResolver(URI canonicalBase, ReadSession session); @Override void registerShutdownListener(ShutdownListener listener);  }