Skip to content

Failing test for gh-13945 #13971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.concurrent.ThreadLocalRandom;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -64,6 +65,16 @@ public void verifyShouldUseProxyTarget() throws Exception {
verify(this.dateService, times(1)).getDate(matchesAnyBoolean());
}

@Test
public void verifyShouldUseProxyTargetWithMethodArguments() throws Exception {
Long d1 = this.dateService.getRandomDate(1234L);
Thread.sleep(200);
Long d2 = this.dateService.getRandomDate(1234L);
assertThat(d1).isEqualTo(d2);
verify(this.dateService, times(1)).getRandomDate(1234L);
}


private boolean matchesFalse() {
if (isTestingMockito1()) {
Method method = ReflectionUtils.findMethod(
Expand Down Expand Up @@ -103,7 +114,7 @@ public CacheResolver cacheResolver(CacheManager cacheManager) {
@Bean
public ConcurrentMapCacheManager cacheManager() {
ConcurrentMapCacheManager cacheManager = new ConcurrentMapCacheManager();
cacheManager.setCacheNames(Arrays.asList("test"));
cacheManager.setCacheNames(Arrays.asList("test", "test2"));
return cacheManager;
}

Expand All @@ -117,6 +128,11 @@ public Long getDate(boolean arg) {
return System.nanoTime();
}

@Cacheable(cacheNames = "test2", key = "#seed")
public Long getRandomDate(Long seed) {
return ThreadLocalRandom.current().nextLong(seed);
}

}

}