@Test public void performActionWithNullBannerId() throws Exception { bannerDTO = new BannerableDTO(null, 5L); context.checking(new Expectations() { { allowing(actionContext).getParams(); will(returnValue(testParam)); ignoring(user); oneOf(bannerableMapper).getBannerableDTO(5L); will(returnValue(bannerDTO)); oneOf(bannerableMapper).updateBannerId(5L, null); will(returnValue(true)); oneOf(cachedBannerMapperMock).execute(with(any(UpdateCachedBannerMapperRequest.class))); } }); sut.execute(actionContext); context.assertIsSatisfied(); }
@Override public Bannerable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { Long entityId = (Long) inActionContext.getParams(); Bannerable bannerObject = mapper.getBannerableDTO(entityId); if (bannerObject.getBannerId() != null) { imageWriter.delete("n" + bannerObject.getBannerId()); } boolean result = mapper.updateBannerId(entityId, null); updateCachedBannerMapper.execute(new UpdateCachedBannerMapperRequest(null, entityId)); return bannerObject; } catch (Exception ex) { log.error("Error deleting banner.", ex); throw new ExecutionException("Error deleting banner.", ex); } }
DeleteBannerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Bannerable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { Long entityId = (Long) inActionContext.getParams(); Bannerable bannerObject = mapper.getBannerableDTO(entityId); if (bannerObject.getBannerId() != null) { imageWriter.delete("n" + bannerObject.getBannerId()); } boolean result = mapper.updateBannerId(entityId, null); updateCachedBannerMapper.execute(new UpdateCachedBannerMapperRequest(null, entityId)); return bannerObject; } catch (Exception ex) { log.error("Error deleting banner.", ex); throw new ExecutionException("Error deleting banner.", ex); } } }
DeleteBannerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Bannerable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { Long entityId = (Long) inActionContext.getParams(); Bannerable bannerObject = mapper.getBannerableDTO(entityId); if (bannerObject.getBannerId() != null) { imageWriter.delete("n" + bannerObject.getBannerId()); } boolean result = mapper.updateBannerId(entityId, null); updateCachedBannerMapper.execute(new UpdateCachedBannerMapperRequest(null, entityId)); return bannerObject; } catch (Exception ex) { log.error("Error deleting banner.", ex); throw new ExecutionException("Error deleting banner.", ex); } } DeleteBannerExecution(final BannerableMapper inMapper,
            final BaseArgCachedDomainMapper<UpdateCachedBannerMapperRequest, Object> inUpdateCachedBannerMapper,
            final ImageWriter inImageWriter); }
DeleteBannerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Bannerable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { Long entityId = (Long) inActionContext.getParams(); Bannerable bannerObject = mapper.getBannerableDTO(entityId); if (bannerObject.getBannerId() != null) { imageWriter.delete("n" + bannerObject.getBannerId()); } boolean result = mapper.updateBannerId(entityId, null); updateCachedBannerMapper.execute(new UpdateCachedBannerMapperRequest(null, entityId)); return bannerObject; } catch (Exception ex) { log.error("Error deleting banner.", ex); throw new ExecutionException("Error deleting banner.", ex); } } DeleteBannerExecution(final BannerableMapper inMapper,
            final BaseArgCachedDomainMapper<UpdateCachedBannerMapperRequest, Object> inUpdateCachedBannerMapper,
            final ImageWriter inImageWriter); @Override Bannerable execute(final PrincipalActionContext inActionContext); }
DeleteBannerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Bannerable execute(final PrincipalActionContext inActionContext) throws ExecutionException { try { Long entityId = (Long) inActionContext.getParams(); Bannerable bannerObject = mapper.getBannerableDTO(entityId); if (bannerObject.getBannerId() != null) { imageWriter.delete("n" + bannerObject.getBannerId()); } boolean result = mapper.updateBannerId(entityId, null); updateCachedBannerMapper.execute(new UpdateCachedBannerMapperRequest(null, entityId)); return bannerObject; } catch (Exception ex) { log.error("Error deleting banner.", ex); throw new ExecutionException("Error deleting banner.", ex); } } DeleteBannerExecution(final BannerableMapper inMapper,
            final BaseArgCachedDomainMapper<UpdateCachedBannerMapperRequest, Object> inUpdateCachedBannerMapper,
            final ImageWriter inImageWriter); @Override Bannerable execute(final PrincipalActionContext inActionContext);  }