Sha256: 52f821c0ef379110299f0298e83b3556e481e938754479436ce0a0d3ff93229b

Contents?: true

Size: 1.71 KB

Versions: 103

Compression:

Stored size: 1.71 KB

Contents

import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import static org.junit.Assert.*;

/**
 * Step 3: Generate random key if key isn't specified. Check key is right format
 */
public class SimpleCipherStepThreeTest {
    @Rule
    public ExpectedException expectedException = ExpectedException.none();

    @Ignore
    @Test
    public void cipherKeyIsMadeOfLetters() {
        assertTrue(new Cipher().getKey().matches("[a-z]+"));
    }

    @Ignore
    @Test
    public void defaultCipherKeyIs100Characters() {
        assertEquals(100, new Cipher().getKey().length());
    }

    @Ignore
    @Test
    public void cipherKeysAreRandomlyGenerated() {
        String newKey = new Cipher().getKey();
        assertFalse("Cipher constructor without argument should generate a random key. No two calls to the" +
                " constructor should generate the same key. Two calls to the constructor " +
                "both returned key: " + newKey, newKey.equals(new Cipher().getKey()));
    }

    @Ignore
    @Test
    public void cipherThrowsWithAllCapsKey() {
        expectedException.expect(IllegalArgumentException.class);
        new Cipher("ABCDEF");
    }

    @Ignore
    @Test
    public void cipherThrowsWithAnyCapsKey() {
        expectedException.expect(IllegalArgumentException.class);
        new Cipher("abcdEFg");
    }

    @Ignore
    @Test
    public void cipherThrowsWithNumericKey() {
        expectedException.expect(IllegalArgumentException.class);
        new Cipher("12345");
    }

    @Ignore
    @Test
    public void cipherThrowsWithAnyNumericKey() {
        expectedException.expect(IllegalArgumentException.class);
        new Cipher("abcd345ef");
    }
}

Version data entries

103 entries across 103 versions & 1 rubygems

Version Path
trackler-2.1.0.8 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.1.0.7 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.1.0.6 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.1.0.5 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.1.0.4 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.1.0.3 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.1.0.2 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.1.0.1 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.1.0.0 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.55 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.54 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.53 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.52 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.51 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.50 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.49 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.48 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.47 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.46 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
trackler-2.0.8.45 tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java