Remane shouldExtendLifetime to meaningful maybeExtendLifetime
Test: all pipeline test
Change-Id: If24a2c0bc5b5ab3c26e32dbef4f7c3b6cd618dab
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java
index bf81ea5..b6d2150 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java
@@ -622,7 +622,7 @@
entry.mLifetimeExtenders.clear();
mAmDispatchingToOtherCode = true;
for (NotifLifetimeExtender extender : mLifetimeExtenders) {
- if (extender.shouldExtendLifetime(entry, entry.mCancellationReason)) {
+ if (extender.maybeExtendLifetime(entry, entry.mCancellationReason)) {
mLogger.logLifetimeExtended(entry.getKey(), extender);
entry.mLifetimeExtenders.add(extender);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinator.kt
index dbecf1c..ac00581 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinator.kt
@@ -84,7 +84,7 @@
onEndLifetimeExtensionCallback = callback
}
- override fun shouldExtendLifetime(entry: NotificationEntry, reason: Int): Boolean {
+ override fun maybeExtendLifetime(entry: NotificationEntry, reason: Int): Boolean {
val isShowingGuts = isCurrentlyShowingGuts(entry)
if (isShowingGuts) {
notifsExtendingLifetime.add(entry.key)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.java
index f9f0b9d..7410912 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.java
@@ -178,7 +178,7 @@
}
@Override
- public boolean shouldExtendLifetime(@NonNull NotificationEntry entry, int reason) {
+ public boolean maybeExtendLifetime(@NonNull NotificationEntry entry, int reason) {
boolean extend = !mHeadsUpManager.canRemoveImmediately(entry.getKey());
if (extend) {
if (isSticky(entry)) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifLifetimeExtender.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifLifetimeExtender.java
index 2fe3bd6..70ad8a5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifLifetimeExtender.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifLifetimeExtender.java
@@ -45,7 +45,7 @@
* called on all lifetime extenders even if earlier ones return true (in other words, multiple
* lifetime extenders can be extending a notification at the same time).
*/
- boolean shouldExtendLifetime(@NonNull NotificationEntry entry, @CancellationReason int reason);
+ boolean maybeExtendLifetime(@NonNull NotificationEntry entry, @CancellationReason int reason);
/**
* Called by the NotifCollection to inform a lifetime extender that its extension of a notif
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtender.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtender.kt
index 145c1e5..51dab72 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtender.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtender.kt
@@ -73,7 +73,7 @@
final override fun getName(): String = name
- final override fun shouldExtendLifetime(entry: NotificationEntry, reason: Int): Boolean {
+ final override fun maybeExtendLifetime(entry: NotificationEntry, reason: Int): Boolean {
val shouldExtend = queryShouldExtendLifetime(entry)
if (debug) {
Log.d(tag, "$name.shouldExtendLifetime(key=${entry.key}, reason=$reason)" +
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java
index a7f8b6e..a69ac58 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java
@@ -459,7 +459,7 @@
mCollection.dismissNotification(entry1, defaultStats(entry1));
// THEN lifetime extenders are never queried
- verify(mExtender1, never()).shouldExtendLifetime(eq(entry1), anyInt());
+ verify(mExtender1, never()).maybeExtendLifetime(eq(entry1), anyInt());
}
@Test
@@ -912,9 +912,9 @@
mNoMan.retractNotif(notif2.sbn, REASON_APP_CANCEL);
// THEN each extender is asked whether to extend, even if earlier ones return true
- verify(mExtender1).shouldExtendLifetime(entry2, REASON_APP_CANCEL);
- verify(mExtender2).shouldExtendLifetime(entry2, REASON_APP_CANCEL);
- verify(mExtender3).shouldExtendLifetime(entry2, REASON_APP_CANCEL);
+ verify(mExtender1).maybeExtendLifetime(entry2, REASON_APP_CANCEL);
+ verify(mExtender2).maybeExtendLifetime(entry2, REASON_APP_CANCEL);
+ verify(mExtender3).maybeExtendLifetime(entry2, REASON_APP_CANCEL);
// THEN the entry is not removed
assertTrue(mCollection.getAllNotifs().contains(entry2));
@@ -948,9 +948,9 @@
mExtender2.callback.onEndLifetimeExtension(mExtender2, entry2);
// THEN each extender is re-queried
- verify(mExtender1).shouldExtendLifetime(entry2, REASON_APP_CANCEL);
- verify(mExtender2).shouldExtendLifetime(entry2, REASON_APP_CANCEL);
- verify(mExtender3).shouldExtendLifetime(entry2, REASON_APP_CANCEL);
+ verify(mExtender1).maybeExtendLifetime(entry2, REASON_APP_CANCEL);
+ verify(mExtender2).maybeExtendLifetime(entry2, REASON_APP_CANCEL);
+ verify(mExtender3).maybeExtendLifetime(entry2, REASON_APP_CANCEL);
// THEN the entry is not removed
assertTrue(mCollection.getAllNotifs().contains(entry2));
@@ -986,9 +986,9 @@
assertTrue(mCollection.getAllNotifs().contains(entry2));
// THEN we don't re-query the extenders
- verify(mExtender1, never()).shouldExtendLifetime(entry2, REASON_APP_CANCEL);
- verify(mExtender2, never()).shouldExtendLifetime(entry2, REASON_APP_CANCEL);
- verify(mExtender3, never()).shouldExtendLifetime(entry2, REASON_APP_CANCEL);
+ verify(mExtender1, never()).maybeExtendLifetime(entry2, REASON_APP_CANCEL);
+ verify(mExtender2, never()).maybeExtendLifetime(entry2, REASON_APP_CANCEL);
+ verify(mExtender3, never()).maybeExtendLifetime(entry2, REASON_APP_CANCEL);
// THEN the entry properly records all extenders that returned true
assertEquals(singletonList(mExtender1), entry2.mLifetimeExtenders);
@@ -1585,7 +1585,7 @@
}
@Override
- public boolean shouldExtendLifetime(
+ public boolean maybeExtendLifetime(
@NonNull NotificationEntry entry,
@CancellationReason int reason) {
return shouldExtendLifetime;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt
index 0f6bd77..4143647 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/GutsCoordinatorTest.kt
@@ -73,43 +73,43 @@
@Test
fun testSimpleLifetimeExtension() {
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
notifGutsViewListener.onGutsOpen(entry1, mock(NotificationGuts::class.java))
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
notifGutsViewListener.onGutsClose(entry1)
verify(lifetimeExtenderCallback).onEndLifetimeExtension(notifLifetimeExtender, entry1)
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
}
@Test
fun testDoubleOpenLifetimeExtension() {
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
notifGutsViewListener.onGutsOpen(entry1, mock(NotificationGuts::class.java))
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
notifGutsViewListener.onGutsOpen(entry1, mock(NotificationGuts::class.java))
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
notifGutsViewListener.onGutsClose(entry1)
verify(lifetimeExtenderCallback).onEndLifetimeExtension(notifLifetimeExtender, entry1)
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
}
@Test
fun testTwoEntryLifetimeExtension() {
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isFalse()
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry2, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isFalse()
notifGutsViewListener.onGutsOpen(entry1, mock(NotificationGuts::class.java))
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isTrue()
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry2, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isFalse()
notifGutsViewListener.onGutsOpen(entry2, mock(NotificationGuts::class.java))
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isTrue()
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry2, 0)).isTrue()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isTrue()
notifGutsViewListener.onGutsClose(entry1)
verify(lifetimeExtenderCallback).onEndLifetimeExtension(notifLifetimeExtender, entry1)
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isFalse()
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry2, 0)).isTrue()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isTrue()
notifGutsViewListener.onGutsClose(entry2)
verify(lifetimeExtenderCallback).onEndLifetimeExtension(notifLifetimeExtender, entry2)
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry1, 0)).isFalse()
- assertThat(notifLifetimeExtender.shouldExtendLifetime(entry2, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
+ assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isFalse()
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.java
index b3ee5f8..8ee892c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.java
@@ -142,7 +142,7 @@
addHUN(mEntry);
when(mHeadsUpManager.canRemoveImmediately(anyString())).thenReturn(false, true);
when(mHeadsUpManager.getEarliestRemovalTime(anyString())).thenReturn(1000L, 0L);
- assertTrue(mNotifLifetimeExtender.shouldExtendLifetime(mEntry, 0));
+ assertTrue(mNotifLifetimeExtender.maybeExtendLifetime(mEntry, 0));
mClock.advanceTime(1000L);
mExecutor.runAllReady();
verify(mHeadsUpManager, times(0))
@@ -156,7 +156,7 @@
when(mHeadsUpManager.isSticky(anyString())).thenReturn(true);
addHUN(mEntry);
when(mHeadsUpManager.getEarliestRemovalTime(anyString())).thenReturn(1000L, 500L);
- assertTrue(mNotifLifetimeExtender.shouldExtendLifetime(mEntry, 0));
+ assertTrue(mNotifLifetimeExtender.maybeExtendLifetime(mEntry, 0));
mClock.advanceTime(1000L);
mExecutor.runAllReady();
verify(mHeadsUpManager, times(0))
@@ -170,7 +170,7 @@
when(mHeadsUpManager.isSticky(anyString())).thenReturn(false);
addHUN(mEntry);
when(mHeadsUpManager.getEarliestRemovalTime(anyString())).thenReturn(1000L, 500L);
- assertTrue(mNotifLifetimeExtender.shouldExtendLifetime(mEntry, 0));
+ assertTrue(mNotifLifetimeExtender.maybeExtendLifetime(mEntry, 0));
mClock.advanceTime(1000L);
mExecutor.runAllReady();
verify(mHeadsUpManager, times(1))
@@ -216,8 +216,8 @@
return true;
});
// THEN only the current HUN, mEntry, should be lifetimeExtended
- assertTrue(mNotifLifetimeExtender.shouldExtendLifetime(mEntry, /* cancellationReason */ 0));
- assertFalse(mNotifLifetimeExtender.shouldExtendLifetime(
+ assertTrue(mNotifLifetimeExtender.maybeExtendLifetime(mEntry, /* cancellationReason */ 0));
+ assertFalse(mNotifLifetimeExtender.maybeExtendLifetime(
new NotificationEntryBuilder()
.setPkg("test-package")
.build(), /* cancellationReason */ 0));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt
index 0ce6ada..7073cc7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RemoteInputCoordinatorTest.kt
@@ -101,27 +101,27 @@
@Test
fun testRemoteInputActive() {
`when`(remoteInputManager.isRemoteInputActive(entry1)).thenReturn(true)
- assertThat(remoteInputActiveExtender.shouldExtendLifetime(entry1, 0)).isTrue()
- assertThat(remoteInputHistoryExtender.shouldExtendLifetime(entry1, 0)).isFalse()
- assertThat(smartReplyHistoryExtender.shouldExtendLifetime(entry1, 0)).isFalse()
+ assertThat(remoteInputActiveExtender.maybeExtendLifetime(entry1, 0)).isTrue()
+ assertThat(remoteInputHistoryExtender.maybeExtendLifetime(entry1, 0)).isFalse()
+ assertThat(smartReplyHistoryExtender.maybeExtendLifetime(entry1, 0)).isFalse()
assertThat(listener.isNotificationKeptForRemoteInputHistory(entry1.key)).isFalse()
}
@Test
fun testRemoteInputHistory() {
`when`(remoteInputManager.shouldKeepForRemoteInputHistory(entry1)).thenReturn(true)
- assertThat(remoteInputActiveExtender.shouldExtendLifetime(entry1, 0)).isFalse()
- assertThat(remoteInputHistoryExtender.shouldExtendLifetime(entry1, 0)).isTrue()
- assertThat(smartReplyHistoryExtender.shouldExtendLifetime(entry1, 0)).isFalse()
+ assertThat(remoteInputActiveExtender.maybeExtendLifetime(entry1, 0)).isFalse()
+ assertThat(remoteInputHistoryExtender.maybeExtendLifetime(entry1, 0)).isTrue()
+ assertThat(smartReplyHistoryExtender.maybeExtendLifetime(entry1, 0)).isFalse()
assertThat(listener.isNotificationKeptForRemoteInputHistory(entry1.key)).isTrue()
}
@Test
fun testSmartReplyHistory() {
`when`(remoteInputManager.shouldKeepForSmartReplyHistory(entry1)).thenReturn(true)
- assertThat(remoteInputActiveExtender.shouldExtendLifetime(entry1, 0)).isFalse()
- assertThat(remoteInputHistoryExtender.shouldExtendLifetime(entry1, 0)).isFalse()
- assertThat(smartReplyHistoryExtender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(remoteInputActiveExtender.maybeExtendLifetime(entry1, 0)).isFalse()
+ assertThat(remoteInputHistoryExtender.maybeExtendLifetime(entry1, 0)).isFalse()
+ assertThat(smartReplyHistoryExtender.maybeExtendLifetime(entry1, 0)).isTrue()
assertThat(listener.isNotificationKeptForRemoteInputHistory(entry1.key)).isTrue()
}
@@ -136,7 +136,7 @@
verify(lifetimeExtensionCallback, never()).onEndLifetimeExtension(any(), any())
// Start extending lifetime & validate that the extension is ended
- assertThat(remoteInputActiveExtender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(remoteInputActiveExtender.maybeExtendLifetime(entry1, 0)).isTrue()
assertThat(remoteInputActiveExtender.isExtending(entry1.key)).isTrue()
listener.onPanelCollapsed()
verify(lifetimeExtensionCallback).onEndLifetimeExtension(remoteInputActiveExtender, entry1)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt
index 37ad835..a09f3a3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/notifcollection/SelfTrackingLifetimeExtenderTest.kt
@@ -77,7 +77,7 @@
@Test
fun testNoExtend() {
`when`(shouldExtend.test(entry1)).thenReturn(false)
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isFalse()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isFalse()
assertThat(extender.isExtending(entry1.key)).isFalse()
verify(onStarted, never()).accept(entry1)
verify(onCanceled, never()).accept(entry1)
@@ -86,7 +86,7 @@
@Test
fun testExtendThenCancelForRepost() {
`when`(shouldExtend.test(entry1)).thenReturn(true)
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
verify(onStarted).accept(entry1)
verify(onCanceled, never()).accept(entry1)
assertThat(extender.isExtending(entry1.key)).isTrue()
@@ -108,7 +108,7 @@
@Test
fun testExtendThenEnd() {
`when`(shouldExtend.test(entry1)).thenReturn(true)
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
verify(onStarted).accept(entry1)
assertThat(extender.isExtending(entry1.key)).isTrue()
extender.endLifetimeExtension(entry1.key)
@@ -119,7 +119,7 @@
@Test
fun testExtendThenEndAfterDelay() {
`when`(shouldExtend.test(entry1)).thenReturn(true)
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
verify(onStarted).accept(entry1)
assertThat(extender.isExtending(entry1.key)).isTrue()
@@ -142,11 +142,11 @@
fun testExtendThenEndAll() {
`when`(shouldExtend.test(entry1)).thenReturn(true)
`when`(shouldExtend.test(entry2)).thenReturn(true)
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
verify(onStarted).accept(entry1)
assertThat(extender.isExtending(entry1.key)).isTrue()
assertThat(extender.isExtending(entry2.key)).isFalse()
- assertThat(extender.shouldExtendLifetime(entry2, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry2, 0)).isTrue()
verify(onStarted).accept(entry2)
assertThat(extender.isExtending(entry1.key)).isTrue()
assertThat(extender.isExtending(entry2.key)).isTrue()
@@ -160,11 +160,11 @@
@Test
fun testExtendWithinEndCanReExtend() {
`when`(shouldExtend.test(entry1)).thenReturn(true)
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
verify(onStarted, times(1)).accept(entry1)
`when`(callback.onEndLifetimeExtension(extender, entry1)).thenAnswer {
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
}
extender.endLifetimeExtension(entry1.key)
verify(onStarted, times(2)).accept(entry1)
@@ -174,11 +174,11 @@
@Test
fun testExtendWithinEndCanNotReExtend() {
`when`(shouldExtend.test(entry1)).thenReturn(true, false)
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
verify(onStarted, times(1)).accept(entry1)
`when`(callback.onEndLifetimeExtension(extender, entry1)).thenAnswer {
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isFalse()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isFalse()
}
extender.endLifetimeExtension(entry1.key)
verify(onStarted, times(1)).accept(entry1)
@@ -188,11 +188,11 @@
@Test
fun testExtendWithinEndAllCanReExtend() {
`when`(shouldExtend.test(entry1)).thenReturn(true)
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
verify(onStarted, times(1)).accept(entry1)
`when`(callback.onEndLifetimeExtension(extender, entry1)).thenAnswer {
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
}
extender.endAllLifetimeExtensions()
verify(onStarted, times(2)).accept(entry1)
@@ -202,11 +202,11 @@
@Test
fun testExtendWithinEndAllCanNotReExtend() {
`when`(shouldExtend.test(entry1)).thenReturn(true, false)
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isTrue()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isTrue()
verify(onStarted, times(1)).accept(entry1)
`when`(callback.onEndLifetimeExtension(extender, entry1)).thenAnswer {
- assertThat(extender.shouldExtendLifetime(entry1, 0)).isFalse()
+ assertThat(extender.maybeExtendLifetime(entry1, 0)).isFalse()
}
extender.endAllLifetimeExtensions()
verify(onStarted, times(1)).accept(entry1)