File tree Expand file tree Collapse file tree
src/test/java/org/kohsuke/github Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,13 @@ private static void alignToStartOfSecond() {
2121 }
2222 }
2323
24+ /**
25+ * Tests that the cache returns the same value without querying again when accessed multiple times within the same
26+ * second.
27+ *
28+ * @throws Exception
29+ * if the test fails
30+ */
2431 @ Test
2532 public void cachesWithinSameSecond () throws Exception {
2633 alignToStartOfSecond ();
@@ -41,6 +48,13 @@ public void cachesWithinSameSecond() throws Exception {
4148 assertThat (calls .get (), equalTo (1 ));
4249 }
4350
51+ /**
52+ * Tests that multiple concurrent callers only trigger a single refresh of the cached value, preventing redundant
53+ * queries.
54+ *
55+ * @throws Exception
56+ * if the test fails
57+ */
4458 @ Test
4559 public void concurrentCallersOnlyRefreshOnce () throws Exception {
4660 alignToStartOfSecond ();
@@ -82,6 +96,13 @@ public void concurrentCallersOnlyRefreshOnce() throws Exception {
8296 }
8397 }
8498
99+ /**
100+ * Tests that the cache is refreshed after one second has elapsed, triggering a new query to retrieve the updated
101+ * value.
102+ *
103+ * @throws Exception
104+ * if the test fails
105+ */
85106 @ Test
86107 public void refreshesAfterOneSecond () throws Exception {
87108 GitHubSanityCachedValue <String > cachedValue = new GitHubSanityCachedValue <>();
You can’t perform that action at this time.
0 commit comments