Sha256: ac14a88f6b4007780f6c5ed59e58f4390a2ba69b89a8a587482882f73fd79f12

Contents?: true

Size: 1.67 KB

Versions: 75

Compression:

Stored size: 1.67 KB

Contents

import org.junit.Test;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import java.util.Arrays;
import java.util.Collection;

import static org.junit.Assert.assertEquals;

@RunWith(Parameterized.class)
public class RaindropsTest {

    private int inputNumber;
    private String outputFromRaindropConversion;

    @Parameters(name = "{index}: expected input number {0} to be converted to \"{1}\"")
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][]{
                // Non-primes
                {1, "1"},
                {52, "52"},
                {12121, "12121"},

                // Numbers with 3 as a prime factor
                {3, "Pling"},
                {6, "Pling"},
                {9, "Pling"},

                // Numbers with 5 as a prime factor
                {5, "Plang"},
                {10, "Plang"},
                {25, "Plang"},

                // Numbers with 7 as a prime factor
                {7, "Plong"},
                {14, "Plong"},
                {49, "Plong"},

                // Numbers with multiple activating prime factors
                {15, "PlingPlang"},
                {21, "PlingPlong"},
                {35, "PlangPlong"},
                {105, "PlingPlangPlong"},
        });
    }

    public RaindropsTest(int inputNumber, String outputFromRaindropConversion) {
        this.inputNumber = inputNumber;
        this.outputFromRaindropConversion = outputFromRaindropConversion;
    }


    @Test
    public void test() {
        assertEquals(outputFromRaindropConversion, Raindrops.convert(inputNumber));
    }
}

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
trackler-2.0.8.22 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.21 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.20 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.19 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.18 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.17 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.16 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.15 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.14 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.13 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.12 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.11 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.10 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.9 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.8 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.7 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.6 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.5 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.4 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java
trackler-2.0.8.3 tracks/java/exercises/raindrops/src/test/java/RaindropsTest.java