@Test(expected = RuntimeException.class) public void testRefreshWithNullSuffix() { final Object request = new Object(); final Object response = new Object(); final String prefix = "PREFIX:"; final String suffix = null; SingleValueCacheRefreshStrategy<Object, Object> sut = new SingleValueCacheRefreshStrategy<Object, Object>( prefix, cacheKeySuffixTransformer); sut.setCache(cache); context.checking(new Expectations() { { oneOf(cacheKeySuffixTransformer).transform(request); will(returnValue(suffix)); } }); sut.refresh(request, response); }
@Override public void refresh(final Request inRequest, final Response inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (cacheKeySuffix == null) { throw new RuntimeException("Null cache key suffix"); } getCache().set(cacheKeyPrefix + cacheKeySuffix, inResponse); }
SingleValueCacheRefreshStrategy extends CachedDomainMapper implements
        RefreshStrategy<Request, Response> { @Override public void refresh(final Request inRequest, final Response inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (cacheKeySuffix == null) { throw new RuntimeException("Null cache key suffix"); } getCache().set(cacheKeyPrefix + cacheKeySuffix, inResponse); } }
SingleValueCacheRefreshStrategy extends CachedDomainMapper implements
        RefreshStrategy<Request, Response> { @Override public void refresh(final Request inRequest, final Response inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (cacheKeySuffix == null) { throw new RuntimeException("Null cache key suffix"); } getCache().set(cacheKeyPrefix + cacheKeySuffix, inResponse); } SingleValueCacheRefreshStrategy(final String inCacheKeyPrefix,
            final Transformer<Request, String> inCacheKeySuffixTransformer); }
SingleValueCacheRefreshStrategy extends CachedDomainMapper implements
        RefreshStrategy<Request, Response> { @Override public void refresh(final Request inRequest, final Response inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (cacheKeySuffix == null) { throw new RuntimeException("Null cache key suffix"); } getCache().set(cacheKeyPrefix + cacheKeySuffix, inResponse); } SingleValueCacheRefreshStrategy(final String inCacheKeyPrefix,
            final Transformer<Request, String> inCacheKeySuffixTransformer); @Override void refresh(final Request inRequest, final Response inResponse); }
SingleValueCacheRefreshStrategy extends CachedDomainMapper implements
        RefreshStrategy<Request, Response> { @Override public void refresh(final Request inRequest, final Response inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (cacheKeySuffix == null) { throw new RuntimeException("Null cache key suffix"); } getCache().set(cacheKeyPrefix + cacheKeySuffix, inResponse); } SingleValueCacheRefreshStrategy(final String inCacheKeyPrefix,
            final Transformer<Request, String> inCacheKeySuffixTransformer); @Override void refresh(final Request inRequest, final Response inResponse);  }