Sha256: bc1e0b6b4a0536bf00cdc6e43884466ce37835ded6affd71c290db9b70b512cd

Contents?: true

Size: 1.9 KB

Versions: 39

Compression:

Stored size: 1.9 KB

Contents

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

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

public class HammingTest {

    @Rule
    public ExpectedException thrown = ExpectedException.none();
    
    @Test
    public void testNoDifferenceBetweenIdenticalStrands() {
        assertThat(new Hamming("A", "A").getHammingDistance(), is(0));
    }

    @Ignore("Remove to run test")
    @Test
    public void testHammingDistanceForSingleNucleotideStrand() {
        assertThat(new Hamming("A", "G").getHammingDistance(), is(1));
    }

    @Ignore("Remove to run test")
    @Test
    public void testHammingDistanceForSmallStrand() {
        assertThat(new Hamming("AG", "CT").getHammingDistance(), is(2));
    }

    @Ignore("Remove to run test")
    @Test
    public void testSmallHammingDistance() {
        assertThat(new Hamming("AT", "CT").getHammingDistance(), is(1));
    }

    @Ignore("Remove to run test")
    @Test
    public void testSmallHammingDistanceInLongerStrand() {
        assertThat(new Hamming("GGACG", "GGTCG").getHammingDistance(), is(1));
    }

    @Ignore("Remove to run test")
    @Test
    public void testValidatesFirstStrandNotLonger() {
        thrown.expect(IllegalArgumentException.class);
        new Hamming("AAAG", "AAA");
    }

    @Ignore("Remove to run test")
    @Test
    public void testValidatesOtherStrandNotLonger() {
        thrown.expect(IllegalArgumentException.class);
        new Hamming("AAA", "AAAG");
    }

    @Ignore("Remove to run test")
    @Test
    public void testLargeHammingDistance() {
        assertThat(new Hamming("GATACA", "GCATAA").getHammingDistance(), is(4));
    }

    @Ignore("Remove to run test")
    @Test
    public void testHammingDistanceInVeryLongStrand() {
        assertThat(new Hamming("GGACGGATTCTG", "AGGACGGATTCT").getHammingDistance(), is(9));
    }

}

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
trackler-2.1.0.27 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.26 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.25 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.24 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.23 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.22 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.21 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.20 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.19 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.18 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.17 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.16 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.15 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.14 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.13 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.12 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.11 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.10 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.9 tracks/java/exercises/hamming/src/test/java/HammingTest.java