Sha256: 80573b26dddbca73fb64e235e257d6aee396c8e7a14bef8ecf0e4f8eff594758

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

package bae;

import bae.Document;
import org.junit.Test;

import java.util.Map;

import static org.junit.Assert.*;

public class DocumentTest {

    @Test
    public void testCanCreateAccurateFrequencyTable() {
        Document document = new Document("aaa bbb aaa bbb ccc");
        Map<String, Long> frequencyMap = document.getFrequencyMap();

        assertEquals(2, (long)frequencyMap.get("aaa"));
        assertEquals(2, (long)frequencyMap.get("bbb"));
        assertEquals(1, (long)frequencyMap.get("ccc"));
    }

    @Test
    public void testCanParseADirtyString() {
        Document document = new Document(" a    aaa\ta     \t\t\t  aa  a      bbb a  aaa   bbb   ccc    ");
        Map<String, Long> frequencyMap = document.getFrequencyMap();

        assertEquals(2, (long)frequencyMap.get("aaa"));
        assertEquals(2, (long)frequencyMap.get("bbb"));
        assertEquals(1, (long)frequencyMap.get("ccc"));
        assertEquals(1, (long)frequencyMap.get("aa"));
        assertEquals(4, (long)frequencyMap.get("a"));
    }

}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bae-0.2.0 src/test/java/bae/DocumentTest.java
bae-0.1.0 src/test/java/bae/DocumentTest.java
bae-0.0.9 src/test/java/bae/DocumentTest.java
bae-0.0.8-java src/test/java/bae/DocumentTest.java
bae-0.0.7-java src/test/java/bae/DocumentTest.java
bae-0.0.6-java src/test/java/bae/DocumentTest.java
bae-0.0.5-java src/test/java/bae/DocumentTest.java
bae-0.0.4-java src/test/java/bae/DocumentTest.java
bae-0.0.3-java src/test/java/bae/DocumentTest.java
bae-0.0.2-java src/test/java/bae/DocumentTest.java
bae-0.0.1 src/test/java/bae/DocumentTest.java