school/old/StudentClass/MyStudentTest.java
2021-02-03 11:27:29 -05:00

57 lines
1.8 KiB
Java

import org.junit.*;
/****************************************************
* MyStudentTest - to test the class Student
*
* @author Resendiz
* @version January 2021
****************************************************/
public class MyStudentTest {
/******************************************************
* Test default constructor - no input parameters
*****************************************************/
@Test
public void testDefaultConstructor() {
Student s = new Student();
Assert.assertEquals("Student name should be set to Louie", "Louie",
s.getName());
Assert.assertEquals("GPA should be set to 1.0",
1.0, s.getGPA(),0.1);
}
/******************************************************
* Test setName
*****************************************************/
@Test
public void testSetName() {
Student s = new Student();
s.setName("Jon");
Assert.assertEquals("Student name should be set to Jon", "Jon",
s.getName());
}
/******************************************************
* Test setGPA
*****************************************************/
@Test
public void testSetGPA() {
Student s = new Student();
s.setGPA(4.0);
Assert.assertEquals("GPA should be 4.0 after being to max",
4.0, s.getGPA(),0.1);
}
/******************************************************
* Test Types
*****************************************************/
@Test
public void testTypes() {
Student s = new Student();
//Assert.assertEquals("The type of name should be string", );
Assert.assertEquals("The type of name should be string",
String.class, s.getName().getClass());
}
}