Aussagelose Tests aus `BackOffStateTest` entfernt
authorKai Moritz <kai@juplo.de>
Fri, 10 Jan 2025 22:12:20 +0000 (23:12 +0100)
committerKai Moritz <kai@juplo.de>
Thu, 6 Feb 2025 17:04:39 +0000 (18:04 +0100)
src/test/java/de/juplo/kafka/BackOffStateTest.java

index cb9d641..605d05d 100644 (file)
@@ -22,7 +22,6 @@ class BackOffStateTest
   final static String ID = "TEST";
   final static TopicPartition TOPIC_PARTITION = new TopicPartition("test", 0);
   final static long OFFSET = 666;
-  final static long OTHER_OFFSET = 1;
   final static Instant NOW = Instant.now();
 
   @Mock Clock clock;
@@ -61,19 +60,6 @@ class BackOffStateTest
     assertThat(backOffState.isStarted(OFFSET)).isFalse();
   }
 
-  @Test
-  @DisplayName("A not started BackOffState is not completed")
-  void NotStartedBackOffStateIsNotCompleted()
-  {
-    // GIVEN
-    BackOffState backOffState = NotStartedBackOffState();
-
-    // WHEN
-
-    // THEN
-    assertThat(backOffState.isCompleted()).isFalse();
-  }
-
 
   private BackOffState StartedBackoffStateWithNoRetries()
   {
@@ -163,21 +149,6 @@ class BackOffStateTest
     assertThat(backOffState.isStarted(OFFSET)).isTrue();
   }
 
-  @Test
-  @DisplayName("A started BackOffState is not started for other offsets if the time is not due")
-  void StartedBackOffStateIsNotStartedForOtherOffsetsIfTheTimeIsNotDue()
-  {
-    // GIVEN
-    BackOffState backOffState = StartedBackoffStateWithRetries();
-    given(clock.instant()).willReturn(NOW.plusMillis(1000));
-
-    // WHEN
-    backOffState.isWaitingForNextRetry();
-
-    // THEN
-    assertThat(backOffState.isStarted(OTHER_OFFSET)).isFalse();
-  }
-
   @Test
   @DisplayName("A started BackOffState is not completed if the time is not due")
   void StartedBackOffStateIsNotCompletedIfTimeIsNotDue()
@@ -225,22 +196,6 @@ class BackOffStateTest
     assertThat(backOffState.isStarted(OFFSET)).isTrue();
   }
 
-  @Test
-  @DisplayName("A started BackOffState is not started for other offsets if the time is due but the retry not yet completed")
-  void StartedBackOffStateIsNotStartedForOtherOffsetsIfTheTimeIsDueButRetryNotCompleted()
-  {
-    // GIVEN
-    BackOffState backOffState = StartedBackoffStateWithRetries();
-    given(clock.instant()).willReturn(NOW.plusMillis(1001));
-    given(backOffExecution.nextBackOff()).willReturn(1000l);
-
-    // WHEN
-    backOffState.isWaitingForNextRetry();
-
-    // THEN
-    assertThat(backOffState.isStarted(OTHER_OFFSET)).isFalse();
-  }
-
   @Test
   @DisplayName("A started BackOffState is not completed if the time is due but the retry not yet completed")
   void StartedBackOffStateIsNotCompletedIfTheTimeIsDueButRetryNotCompleted()
@@ -289,22 +244,6 @@ class BackOffStateTest
     assertThat(backOffState.isStarted(OFFSET)).isTrue();
   }
 
-  @Test
-  @DisplayName("A started BackOffState is not started for other offsets if the time is due and the retry is completed")
-  void StartedBackOffStateIsNotStartedForOtherOffsetsIfTheTimeIsDueAndRetryIsCompleted()
-  {
-    // GIVEN
-    BackOffState backOffState = StartedBackoffStateWithRetries();
-    given(clock.instant()).willReturn(NOW.plusMillis(1001));
-    given(backOffExecution.nextBackOff()).willReturn(BackOffExecution.STOP);
-
-    // WHEN
-    backOffState.isWaitingForNextRetry();
-
-    // THEN
-    assertThat(backOffState.isStarted(OTHER_OFFSET)).isFalse();
-  }
-
   @Test
   @DisplayName("A started BackOffState is completed if the time is due and the retry is completed")
   void StartedBackOffStateIsCompletedIfTheTimeIsDueAndRetryIsCompleted()
@@ -348,32 +287,4 @@ class BackOffStateTest
     // THEN
     assertThat(backOffState.isStarted(OFFSET)).isFalse();
   }
-
-  @Test
-  @DisplayName("A started BackOffState is not started for other offsets if it is marked as completed")
-  void StartedBackOffStateIsNotStartedForOtherOffsetsIfMarkedCompleted()
-  {
-    // GIVEN
-    BackOffState backOffState = StartedBackoffStateWithRetries();
-
-    // WHEN
-    backOffState.markAsCompleted();
-
-    // THEN
-    assertThat(backOffState.isStarted(OTHER_OFFSET)).isFalse();
-  }
-
-  @Test
-  @DisplayName("A started BackOffState is not completed if it is marked as completed")
-  void StartedBackOffStateIsNotCompletedIfMarkedCompleted()
-  {
-    // GIVEN
-    BackOffState backOffState = StartedBackoffStateWithRetries();
-
-    // WHEN
-    backOffState.markAsCompleted();
-
-    // THEN
-    assertThat(backOffState.isCompleted()).isFalse(); // ??
-  }
 }