Last active
February 2, 2026 16:45
-
-
Save trikitrok/f14238a9e6ff7c673943fbbef52856ca to your computer and use it in GitHub Desktop.
Tests with no relevant mutants surviving but missing important test cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.argentrose; | |
| 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 java.util.Arrays; | |
| import static org.assertj.core.api.Assertions.assertThat; | |
| public class ArgentRoseStoreTest { | |
| private static final int MIN_QUALITY = 0; | |
| private static final int MAX_QUALITY = 50; | |
| @Test | |
| @DisplayName("Updating a non expired regular product decreases its quality by 2 and decreases its sell-in by 1") | |
| void not_expired_regular_product_update() { | |
| ArgentRoseStore store = argentRoseStoreWith(regularProduct(1, 3)); | |
| store.update(); | |
| assertThat(store).isEqualTo(argentRoseStoreWith(regularProduct(0, 1))); | |
| } | |
| @Test | |
| @DisplayName("Non expired regular product's updated quality can not be negative") | |
| void not_expired_regular_product_updated_quality_can_not_be_negative() { | |
| ArgentRoseStore store = argentRoseStoreWith(regularProduct(30, 1)); | |
| store.update(); | |
| assertThat(store).isEqualTo(argentRoseStoreWith(regularProduct(29, MIN_QUALITY))); | |
| } | |
| @Test | |
| @DisplayName("Already expired regular product decreases quality twice as fast") | |
| void already_expired_regular_product_update() { | |
| ArgentRoseStore store = argentRoseStoreWith(regularProduct(0, 5)); | |
| store.update(); | |
| assertThat(store).isEqualTo(argentRoseStoreWith(regularProduct(-1, 1))); | |
| } | |
| @Test | |
| @DisplayName("Already expired regular product's updated quality can not be negative") | |
| void already_expired_regular_product_updated_quality_can_not_be_negative() { | |
| ArgentRoseStore store = argentRoseStoreWith(regularProduct(-1, 3)); | |
| store.update(); | |
| assertThat(store).isEqualTo(argentRoseStoreWith(regularProduct(-2, MIN_QUALITY))); | |
| } | |
| @Test | |
| @DisplayName("Theatre Passes increases quality by 1 when sell-in is greater than 6 days") | |
| void theatre_passes_quality_increases_by_1_when_sellIn_greater_than_6() { | |
| ArgentRoseStore store = argentRoseStoreWith(theatrePasses(7, 5)); | |
| store.update(); | |
| assertThat(store).isEqualTo(argentRoseStoreWith(theatrePasses(6, 6))); | |
| } | |
| @Test | |
| @DisplayName("Theatre Passes's quality can't grow over 50 when sell-in is greater than 6 days") | |
| void theatre_passes_quality_cant_grow_over_50_when_sell_in_is_greater_than_6_days() { | |
| ArgentRoseStore store = argentRoseStoreWith(theatrePasses(20, MAX_QUALITY)); | |
| store.update(); | |
| assertThat(store).isEqualTo(argentRoseStoreWith(theatrePasses(19, MAX_QUALITY))); | |
| } | |
| @ParameterizedTest | |
| @ValueSource(ints = {1, 6}) | |
| @DisplayName("Theatre Passes increases quality by 3 when sell-in is between 1 and 6 days") | |
| void theatre_passes_quality_increases_by_3_when_sellIn_between_1_and_6(int sellIn) { | |
| ArgentRoseStore store = argentRoseStoreWith(theatrePasses(sellIn, 46)); | |
| store.update(); | |
| assertThat(store).isEqualTo(argentRoseStoreWith(theatrePasses(sellIn - 1, 49))); | |
| } | |
| @Test | |
| @DisplayName("Theatre Passes quality can't grow over 50 when sell-in is between 1 and 6 days") | |
| void theatre_passes_quality_cant_exceed_50_when_sellIn_between_1_and_6() { | |
| ArgentRoseStore store = argentRoseStoreWith(theatrePasses(4, 48)); | |
| store.update(); | |
| assertThat(store).isEqualTo(argentRoseStoreWith(theatrePasses(3, MAX_QUALITY))); | |
| } | |
| @Test | |
| @DisplayName("Theatre Passes quality drops to 0 when expired") | |
| void theatre_passes_quality_drops_to_0_when_expired() { | |
| ArgentRoseStore store = argentRoseStoreWith(theatrePasses(0, 38)); | |
| store.update(); | |
| assertThat(store).isEqualTo(argentRoseStoreWith(theatrePasses(-1, MIN_QUALITY))); | |
| } | |
| private Product theatrePasses(int sellIn, int quality) { | |
| return new Product("Theatre Passes", sellIn, quality); | |
| } | |
| private Product regularProduct(int sellIn, int quality) { | |
| return new Product("any not special product", sellIn, quality); | |
| } | |
| private ArgentRoseStore argentRoseStoreWith(Product... products) { | |
| return new ArgentRoseStore(Arrays.asList(products)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment