public void testOccupationPositive() {
   try {
     _model.setOccupation("Software Engineer");
     _model.setOccupation("Quality-Assurance Tester");
   } catch (IllegalArgumentException e) {
     fail();
   }
 }
 public void testNHINumberLengthIsnt6() {
   // Format is 6 characters long
   try {
     _model.setNHINumber("ABC1234");
     _model.setNHINumber("AB12");
     fail();
   } catch (IllegalArgumentException e) {
   }
 }
 public void testOccupationIsntNull() {
   try {
     _model.setOccupation(null);
     fail();
   } catch (IllegalArgumentException e) {
   }
 }
 public void testNHINumberIsntNull() {
   try {
     _model.setNHINumber(null);
     fail();
   } catch (IllegalArgumentException e) {
   }
 }
 public void testNHINumberPositive() {
   try {
     _model.setNHINumber("ABC123");
   } catch (IllegalArgumentException e) {
     fail();
   }
 }
コード例 #6
0
 public void testHeightNegative() {
   try {
     _model.setHeight(-23);
     fail();
   } catch (IllegalArgumentException e) {
   }
 }
コード例 #7
0
 public void testHeightZero() {
   try {
     _model.setHeight(0);
     fail();
   } catch (IllegalArgumentException e) {
   }
 }
コード例 #8
0
 public void testHeightPositive() {
   try {
     _model.setHeight(75);
   } catch (IllegalArgumentException e) {
     fail();
   }
 }
 public void testNHINumberNonAlphaNumeric() {
   // Allowed characters are a-zA-Z and 0-9
   try {
     _model.setNHINumber("AB#123");
     fail();
   } catch (IllegalArgumentException e) {
   }
 }
 public void testOccupationNonAlphaNumericOrHyphen() {
   // Allowed characters are a-zA-Z and '-'
   try {
     _model.setOccupation("Software@ #Engineer");
     fail();
   } catch (IllegalArgumentException e) {
   }
 }
コード例 #11
0
 public void testHeightRange() {
   try {
     _model.setHeight(500);
     _model.setHeight(400); // Can't be taller than 4 meters
     fail();
   } catch (IllegalArgumentException e) {
   }
 }
コード例 #12
0
 public void testWeightRange() {
   try {
     _model.setWeight(2000); // Can't weigh more than 1000kg
     _model.setWeight(1000); // Can't weigh more than 1000kg
     fail();
   } catch (IllegalArgumentException e) {
   }
 }
  public void testNHIAlphaNumericOrder() {
    // Format is 3 letters followed by 3 numbers
    try {
      _model.setNHINumber("123ABC");
      fail();
    } catch (IllegalArgumentException e) {

    }
  }