@@ -29,7 +29,7 @@ class PauserTest {
2929 private TargetSnapshot targetAfterPause ;
3030 private V1Deployment deployment ;
3131 private V1ObjectMeta objectMeta ;
32- private final String dummyObjectName = "dummyObjectName" ;
32+ private static final String DUMMY_OBJECT_NAME = "dummyObjectName" ;
3333
3434 @ BeforeEach
3535 void beforeEach () throws PauserException {
@@ -44,7 +44,7 @@ void beforeEach() throws PauserException {
4444 doReturn (deployment ).when (targetBeforePause ).getDeployment ();
4545 doReturn (deployment ).when (targetAfterPause ).getDeployment ();
4646 doReturn (objectMeta ).when (deployment ).getMetadata ();
47- doReturn (dummyObjectName ).when (objectMeta ).getName ();
47+ doReturn (DUMMY_OBJECT_NAME ).when (objectMeta ).getName ();
4848 }
4949
5050 @ AfterEach
@@ -337,7 +337,7 @@ void pause_WhenUnpauseWithRetryThrowException_ShouldThrowUnpauseFailedException(
337337 + " command to unpause all pods. Note that the pause operations for taking backup"
338338 + " succeeded. You can use a backup that was taken during this pause duration:"
339339 + " Start Time = %s, End Time = %s. " ,
340- dummyObjectName , startTime , endTime ),
340+ DUMMY_OBJECT_NAME , startTime , endTime ),
341341 thrown .getMessage ());
342342
343343 mockedTime .close ();
@@ -410,9 +410,11 @@ void pause_WhenCompareTargetStatusThrowException_ShouldThrowStatusCheckFailedExc
410410 UnpauseFailedException thrown =
411411 assertThrows (UnpauseFailedException .class , () -> pauser .pause (pauseDuration , null ));
412412 assertEquals (
413- "Unpause operation failed. Scalar products might still be in a paused state. You must"
414- + " restart related pods by using the `kubectl rollout restart deployment"
415- + " dummyObjectName` command to unpause all pods. " ,
413+ String .format (
414+ "Unpause operation failed. Scalar products might still be in a paused state. You must"
415+ + " restart related pods by using the `kubectl rollout restart deployment"
416+ + " %s` command to unpause all pods. " ,
417+ DUMMY_OBJECT_NAME ),
416418 thrown .getMessage ());
417419 }
418420
@@ -487,7 +489,7 @@ void pause_WhenPauseAndUnpauseFailed_ShouldThrowUnpauseFailedException()
487489 + " backup that was taken during this pause"
488490 + " duration. You need to retry the pause operation from the beginning to"
489491 + " take a backup. " ,
490- dummyObjectName ),
492+ DUMMY_OBJECT_NAME ),
491493 thrown .getMessage ());
492494 }
493495
@@ -517,7 +519,7 @@ void pause_WhenUnpauseFailedAndTargetPodStatusChanged_ShouldThrowUnpauseFailedEx
517519 + " command to unpause all pods. The target pods were updated during the pause"
518520 + " duration. You cannot use the backup that was taken during this pause"
519521 + " duration. " ,
520- dummyObjectName ),
522+ DUMMY_OBJECT_NAME ),
521523 thrown .getMessage ());
522524 }
523525
@@ -551,7 +553,7 @@ void pause_WhenPauseAndUnpauseAndTargetPodStatusChanged_ShouldThrowUnpauseFailed
551553 + " operation from the beginning to take a backup. The target pods were updated"
552554 + " during the pause duration. You cannot use the backup that was taken during"
553555 + " this pause duration. " ,
554- dummyObjectName ),
556+ DUMMY_OBJECT_NAME ),
555557 thrown .getMessage ());
556558 }
557559
0 commit comments