Sha256: 808eb67ebd7102d8ae6d3749d911f16ccd0ea5a78737e387a8a2332b67c861f9

Contents?: true

Size: 1.8 KB

Versions: 61

Compression:

Stored size: 1.8 KB

Contents

import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;

import static org.junit.Assert.assertEquals;

public class SubstitutionCipherTest {

    private static final String KEY = "abcdefghij";
    private Cipher cipher;

    @Before
    public void setup() {
        this.cipher = new Cipher(KEY);
    }


    @Test
    public void cipherKeepsTheSubmittedKey() {
        assertEquals(KEY, cipher.getKey());
    }

    @Ignore
    @Test
    public void cipherCanEncodeWithGivenKey() {
        String expectedOutput = "abcdefghij";

        assertEquals(expectedOutput, cipher.encode("aaaaaaaaaa"));
    }

    @Ignore
    @Test
    public void cipherCanDecodeWithGivenKey() {
        String expectedOutput = "aaaaaaaaaa";

        assertEquals(expectedOutput, cipher.decode("abcdefghij"));
    }

    @Ignore
    @Test
    public void cipherIsReversibleGivenKey() {
        String plainText = "abcdefghij";

        assertEquals(plainText, cipher.decode(cipher.encode("abcdefghij")));
    }

    @Ignore
    @Test
    public void cipherCanDoubleShiftEncode() {
        String plainText = "iamapandabear";
        String expectedOutput = "qayaeaagaciai";

        assertEquals(expectedOutput, new Cipher(plainText).encode(plainText));
    }

    @Ignore
    @Test
    public void cipherCanWrapEncode() {
        String expectedOutput = "zabcdefghi";

        assertEquals(expectedOutput, cipher.encode("zzzzzzzzzz"));
    }

    @Ignore
    @Test
    public void cipherCanEncodeMessageThatIsShorterThanTheKey() {
        String expectedOutput = "abcde";

        assertEquals(expectedOutput, cipher.encode("aaaaa"));
    }

    @Ignore
    @Test
    public void cipherCanDecodeMessageThatIsShorterThanTheKey() {
        String expectedOutput = "aaaaa";

        assertEquals(expectedOutput, cipher.decode("abcde"));
    }
}

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
trackler-2.0.6.5 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.6.4 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.6.3 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.6.2 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.6.1 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.6.0 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.18 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.17 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.16 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.15 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.14 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.13 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.12 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.11 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.10 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.9 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.8 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.7 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.6 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
trackler-2.0.5.5 tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java