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.48 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.47 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.46 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.45 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.44 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.43 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.42 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.41 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.40 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.39 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.38 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.37 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.36 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.34 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.33 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.32 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.31 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.30 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.29 tracks/java/exercises/hamming/src/test/java/HammingTest.java
trackler-2.1.0.28 tracks/java/exercises/hamming/src/test/java/HammingTest.java