Sha256: 7e896cd566089ee96894d9617ac51b736d3952bfa4380872c97164c390dfec51

Contents?: true

Size: 1.86 KB

Versions: 38

Compression:

Stored size: 1.86 KB

Contents

import static org.assertj.core.api.Assertions.assertThat;

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

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SchoolTest {
  private final School school = new School();


  @Test
  public void startsWithNoStudents() {
    assertThat(school.db()).isEmpty();
  }

  @Ignore
  @Test
  public void addsStudents() {
    school.add("Aimee", 2);
    assertThat(school.db().get(2)).contains("Aimee");
  }

  @Ignore
  @Test
  public void addsMoreStudentsInSameGrade() {
    final int grade = 2;
    school.add("James", grade);
    school.add("Blair", grade);
    school.add("Paul", grade);

    assertThat(school.db().get(grade)).hasSize(3).contains("James", "Blair", "Paul");
  }

  @Ignore
  @Test
  public void addsStudentsInMultipleGrades() {
    school.add("Chelsea", 3);
    school.add("Logan", 7);

    assertThat(school.db()).hasSize(2);
    assertThat(school.db().get(3)).hasSize(1).contains("Chelsea");
    assertThat(school.db().get(7)).hasSize(1).contains("Logan");
  }

  @Ignore
  @Test
  public void getsStudentsInAGrade() {
    school.add("Franklin", 5);
    school.add("Bradley", 5);
    school.add("Jeff", 1);
    assertThat(school.grade(5)).hasSize(2).contains("Franklin", "Bradley");
  }

  @Ignore
  @Test
  public void getsStudentsInEmptyGrade() {
    assertThat(school.grade(1)).isEmpty();
  }

  @Ignore
  @Test
  public void sortsSchool() {
    school.add("Jennifer", 4);
    school.add("Kareem", 6);
    school.add("Christopher", 4);
    school.add("Kyle", 3);
    Map<Integer, List<String>> sortedStudents = new HashMap<Integer, List<String>>();
    sortedStudents.put(6, Arrays.asList("Kareem"));
    sortedStudents.put(4, Arrays.asList("Christopher", "Jennifer"));
    sortedStudents.put(3, Arrays.asList("Kyle"));

    assertThat(school.sort()).isEqualTo(sortedStudents);
  }
}

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
trackler-2.0.5.1 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.5.0 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.4.0 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.9 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.8 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.7 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.6 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.5 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.4 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.3 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.2 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.1 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.3.0 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.2.0 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.1.2 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.1.1 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.1.0 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.0.10 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.0.9 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java
trackler-2.0.0.8 tracks/java/exercises/grade-school/src/test/java/SchoolTest.java