import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
assertThat(response.getStatusCode()).isEqualTo(HttpStatusCode.valueOf(HttpStatus.NOT_FOUND.value()));
}
+ @DisplayName("Non-existent partition")
+ @ParameterizedTest(name = "partition: {0}")
+ @ValueSource(ints = { -1, NUM_PARTITIONS, 66 })
+ void testNonExistentPartition(int partition)
+ {
+ ResponseEntity<String> response = restTemplate.getForEntity("/{partition}/0", String.class, partition);
+ assertThat(response.getStatusCode()).isEqualTo(HttpStatusCode.valueOf(HttpStatus.NOT_FOUND.value()));
+ }
+
static final String TOPIC = "ExampleConsumerTest_TEST";
static final int NUM_PARTITIONS = 7;