On se retrouve aujourd'hui pour la solution du précédent #KataOfTheWeek proposé par Benjamin en début de semaine !

Une solution en java suivie des tests :

package fr.takima;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.IntStream;

public class FizzBuzz {
    private static Map<Integer, String> ROMAN_NUMERALS = new LinkedHashMap<>();

    {
        ROMAN_NUMERALS.put(100, "C");
        ROMAN_NUMERALS.put(90, "XC");
        ROMAN_NUMERALS.put(50, "L");
        ROMAN_NUMERALS.put(40, "XL");
        ROMAN_NUMERALS.put(10, "X");
        ROMAN_NUMERALS.put(9, "IX");
        ROMAN_NUMERALS.put(5, "V");
        ROMAN_NUMERALS.put(4, "IV");
        ROMAN_NUMERALS.put(1, "I");
    }

    public static void main(String[] args) {
        FizzBuzz app = new FizzBuzz();
        IntStream.range(1, 100).forEach(n -> System.out.println(app.processFizzBuzz(n)));
    }

    String processFizzBuzz(int i) {
        if (i % 7 == 0 || i % 10 == 7) {
            if (i % 5 == 0) {
                return "fizzbuzz";
            } else {
                return "buzz";
            }
        } else if (i % 5 == 0) {
            return "fizz";
        } else {
            return toRoman(i);
        }
    }

    private String toRoman(int number) {
        StringBuilder result = new StringBuilder();
        for (Map.Entry<Integer, String> e : ROMAN_NUMERALS.entrySet()) {
            while (number >= e.getKey()) {
                result.append(e.getValue());
                number -= e.getKey();
            }
        }
        return result.toString();
    }
}

// Les tests

package fr.takima;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class FizzBuzzTest {

    private final FizzBuzz app = new FizzBuzz();

    @Test
    void testProcessFizzBuzz_of_5_return_Fizz() {
        assertEquals(app.processFizzBuzz(5), "fizz");
    }

    @Test
    void testProcessFizzBuzz_of_multiple_5_return_Fizz() {
        for(int i=5; i<100; i=i+5) {
            if (i % 7 != 0) {  // this was added after refacto
                assertEquals(app.processFizzBuzz(i), "fizz");
            }
        }
    }

    @Test
    void testProcessFizzBuzz_of_7_return_Buzz() {
        assertEquals(app.processFizzBuzz(7), "buzz");
    }

    @Test
    void testProcessFizzBuzz_of_multiple_7_return_Buzz() {
        for(int i=7; i<100; i=i+7) {
            if (i % 5 != 0) {  // this was added after refacto
                assertEquals(app.processFizzBuzz(i), "buzz");
            }
        }
    }

    @Test
    void testProcessFizzBuzz_of_17_return_Buzz() {
        assertEquals(app.processFizzBuzz(17), "buzz");
    }

    @Test
    void testProcessFizzBuzz_of_number_ending_by_7_return_Buzz() {
        for(int i=7; i<100; i=i+10) {
            assertEquals(app.processFizzBuzz(i), "buzz");
        }
    }

    @Test
    void testProcessFizzBuzz_of_35_return_FizzBuzz() {
        assertEquals(app.processFizzBuzz(35), "fizzbuzz");
        assertEquals(app.processFizzBuzz(70), "fizzbuzz");
    }

    @Test
    void testProcessFizzBuzz_of_93_print_XCIII() {
        assertEquals(app.processFizzBuzz(93), "XCIII");
    }

    @Test
    void testProcessFizzBuzz_of_51_print_LI() {
        assertEquals(app.processFizzBuzz(51), "LI");
    }

    @Test
    void testProcessFizzBuzz_of_41_print_XLI() {
        assertEquals(app.processFizzBuzz(41), "XLI");
    }

    @Test
    void testProcessFizzBuzz_of_11_print_XI() {
        assertEquals(app.processFizzBuzz(11), "XI");
    }

    @Test
    void testProcessFizzBuzz_of_9_print_IX() {
        assertEquals(app.processFizzBuzz(9), "IX");
    }

    @Test
    void testProcessFizzBuzz_of_4_print_IV() {
        assertEquals(app.processFizzBuzz(4), "IV");
    }

    @Test
    void testProcessFizzBuzz_of_1_print_I() {
        assertEquals(app.processFizzBuzz(1), "I");
    }

    @Test
    void testProcessFizzBuzz_of_19_print_XIX() {
        assertEquals(app.processFizzBuzz(19), "XIX");
    }
}

A bientôt pour un nouveau #KataOfTheWeek !