• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
ivan.ag Avatar
Name:Iván Arroyo González
Clan:metrica_mar25
Member Since:Dec 2024
Last Seen:Jul 2025
Profiles:
Following:25
Followers:24
Allies:24
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Published
ivan.agvs.Devemon4 months ago

Better Test Name

Test Cases
Diff
  • import org.junit.jupiter.params.ParameterizedTest;
    import org.junit.jupiter.params.provider.Arguments;
    import org.junit.jupiter.params.provider.MethodSource;
    
    import java.util.stream.Stream;
    
    import static org.assertj.core.api.Assertions.assertThat;
    
    
    class SolutionTest {
      
        @ParameterizedTest
        @MethodSource("testCases")
        public void expectedValueForTestCase(String inputName, String expectedOutputValue) {
            assertThat(greet.greet(inputName))
                    .as("It should return the expected value for %s", inputName)
                    .isEqualTo(expectedOutputValue);
        }
    
        public static Stream<Arguments> testCases() {
            return Stream.of(
                    Arguments.of("Reemu", "hello my name is Reemu"),
                    Arguments.of("Pepo", "hello my name is Pepo"),
                    Arguments.of("Delacroix", "hello my name is Delacroix"),
                    Arguments.of("Toto", "hello my name is Toto")
            );
        }
    
        private final Greet greet = new Greet();
    }
    
    • import org.junit.jupiter.params.ParameterizedTest;
    • import org.junit.jupiter.params.provider.Arguments;
    • import org.junit.jupiter.params.provider.MethodSource;
    • import java.util.stream.Stream;
    • import static org.assertj.core.api.Assertions.assertThat;
    • class SolutionTest {
    • @ParameterizedTest
    • @MethodSource("testCases")
    • public void it_should_return_the_expected_value_for_test_case(String inputName, String expectedOutputValue) {
    • public void expectedValueForTestCase(String inputName, String expectedOutputValue) {
    • assertThat(greet.greet(inputName))
    • .as("It should return the expected value for %s", inputName)
    • .isEqualTo(expectedOutputValue);
    • }
    • public static Stream<Arguments> testCases() {
    • return Stream.of(
    • Arguments.of("Reemu", "hello my name is Reemu"),
    • Arguments.of("Pepo", "hello my name is Pepo"),
    • Arguments.of("Delacroix", "hello my name is Delacroix"),
    • Arguments.of("Toto", "hello my name is Toto")
    • );
    • }
    • private final Greet greet = new Greet();
    • }
  • Fork
  • Discuss (0)
  • Fixture
  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...