summaryrefslogtreecommitdiff
path: root/src/Q7/PersonTest.java
blob: b7a3d3837ee0fcc534bee9f3c24b31a1ade16639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package ca.mokhan.test;

import Q7.*;
import java.io.*;
import java.text.*;
import java.util.*;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class PersonTest extends TestCase {
  private Person subject;

  public PersonTest(String testName) {
    super(testName);
    this.subject = new Person("mo", 1, 1);
  }

  public static Test suite() {
    return new TestSuite(PersonTest.class);
  }

  public void test_getBMI_underweight() {
    this.subject.setHeight(72);
    this.subject.setWeight(100);

    assertEquals("Underweight", this.subject.getCategory());
  }

  public void test_getBMI_normal() {
    this.subject.setHeight(72);
    this.subject.setWeight(170);

    assertEquals("Normal", this.subject.getCategory());
  }

  public void test_getBMI_overweight() {
    this.subject.setHeight(72);
    this.subject.setWeight(220);

    assertEquals("Overweight", this.subject.getCategory());
  }

  public void test_getBMI_obese() {
    this.subject.setHeight(72);
    this.subject.setWeight(250);

    assertEquals("Obese", this.subject.getCategory());
  }
}