UpdateSingleCacheAdvice extends SingleUpdateCacheAdvice<UpdateSingleCache> { @AfterReturning(pointcut = "updateSingle()", returning = "retVal") public void cacheUpdateSingle(final JoinPoint jp, final Object retVal) throws Throwable { update(jp, retVal); } UpdateSingleCacheAdvice(); @Pointcut("@annotation(com.google.code.ssm.api.UpdateSingleCache)") void updateSingle(); @AfterReturning(pointcut = "updateSingle()", returning = "retVal") void cacheUpdateSingle(final JoinPoint jp, final Object retVal);  }
@Test public void valid() throws Throwable { Assume.assumeTrue(isValid); advice.cacheUpdateSingle(pjp, returnValue); verify(cache).set(eq(cacheKey), eq(EXPIRATION), eq(expectedValue), any(SerializationType.class)); }
@Test public void invalid() throws Throwable { Assume.assumeThat(isValid, CoreMatchers.is(false)); advice.cacheUpdateSingle(pjp, returnValue); verify(cache, never()).set(anyString(), anyInt(), any(), any(SerializationType.class)); }