Sha256: 9e72ae450ae7a9dfd584f45c2dba4b830a89ce078092f3e332c9e049a123b2a5

Contents?: true

Size: 1.7 KB

Versions: 186

Compression:

Stored size: 1.7 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 RaindropConverterTest {

    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 RaindropConverterTest(int inputNumber, String outputFromRaindropConversion) {
        this.inputNumber = inputNumber;
        this.outputFromRaindropConversion = outputFromRaindropConversion;
    }


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

Version data entries

186 entries across 186 versions & 1 rubygems

Version Path
trackler-2.2.1.91 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.90 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.89 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.88 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.87 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.86 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.85 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.84 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.83 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.82 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.81 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.80 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.79 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.78 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.77 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.76 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.75 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.74 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.73 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java
trackler-2.2.1.72 tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java