Advertisement
Guest User

StudentTest

a guest
Feb 25th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.17 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package oosd2;
  7.  
  8. import org.junit.After;
  9. import org.junit.AfterClass;
  10. import org.junit.Before;
  11. import org.junit.BeforeClass;
  12. import org.junit.Test;
  13. import static org.junit.Assert.*;
  14.  
  15. /**
  16.  *
  17.  * @author Marken Tuan Nguyen
  18.  */
  19. public class StudentTest {
  20.    
  21.     public StudentTest() {
  22.     }
  23.    
  24.     @BeforeClass
  25.     public static void setUpClass() {
  26.     }
  27.    
  28.     @AfterClass
  29.     public static void tearDownClass() {
  30.     }
  31.    
  32.     @Before
  33.     public void setUp() {
  34.     }
  35.    
  36.     @After
  37.     public void tearDown() {
  38.     }
  39.  
  40.     /**
  41.      * Test of getStudentID method, of class Student.
  42.      */
  43.     @Test
  44.     public void testGetStudentID() {
  45.         System.out.println("getStudentID");
  46.        
  47.         int studentID = 100;
  48.         Student instance = new Student(studentID,"");
  49.         int result = instance.getStudentID();
  50.         assertEquals(studentID, result);
  51.         // TODO review the generated test code and remove the default call to fail.
  52.         //fail("The test case is a prototype.");
  53.     }
  54.  
  55.     /**
  56.      * Test of setStudentID method, of class Student.
  57.      */
  58.     @Test
  59.     public void testSetStudentID() {
  60.         System.out.println("setStudentID");
  61.         Student instance = new Student(99,"");
  62.         System.out.println("\tBefore set: "+instance.getStudentID());
  63.        
  64.        
  65.         instance.setStudentID(100);
  66.         System.out.println("\tAfter set: "+instance.getStudentID());
  67.         // TODO review the generated test code and remove the default call to fail.
  68.         //fail("The test case is a prototype.");
  69.     }
  70.  
  71.     /**
  72.      * Test of getStudentName method, of class Student.
  73.      */
  74.     @Test
  75.     public void testGetStudentName() {
  76.         System.out.println("getStudentName");
  77.         Student instance = new Student(123,"Marken");
  78.         String studentName = "Marken";
  79.         String result = instance.getStudentName();
  80.         assertEquals(studentName, result);
  81.         // TODO review the generated test code and remove the default call to fail.
  82.         //fail("The test case is a prototype.");
  83.     }
  84.  
  85.     /**
  86.      * Test of setStudentName method, of class Student.
  87.      */
  88.     @Test
  89.     public void testSetStudentName() {
  90.         System.out.println("setStudentName");
  91.        
  92.         Student instance = new Student(123,"Marken");
  93.         System.out.println("\tBefore set: "+instance.getStudentName());
  94.        
  95.        
  96.         instance.setStudentName("Brendan");
  97.         System.out.println("\tAfter set: "+instance.getStudentName());
  98.         // TODO review the generated test code and remove the default call to fail.
  99.         //fail("The test case is a prototype.");
  100.     }
  101.  
  102.     /**
  103.      * Test of getStudentPhone method, of class Student.
  104.      */
  105.     @Test
  106.     public void testGetStudentPhone() {
  107.         System.out.println("getStudentPhone");
  108.         Student instance = new Student();
  109.         int expResult = 0;
  110.         int result = instance.getStudentPhone();
  111.         assertEquals(expResult, result);
  112.         // TODO review the generated test code and remove the default call to fail.
  113.         //fail("The test case is a prototype.");
  114.     }
  115.  
  116.     /**
  117.      * Test of setStudentPhone method, of class Student.
  118.      */
  119.     @Test
  120.     public void testSetStudentPhone() {
  121.         System.out.println("setStudentPhone");
  122.        
  123.         Student instance = new Student();
  124.         System.out.println("\tBefore set: "+instance.getStudentPhone());
  125.         instance.setStudentPhone(123456789);
  126.         System.out.println("\tAfter set: "+instance.getStudentPhone());
  127.         // TODO review the generated test code and remove the default call to fail.
  128.         //fail("The test case is a prototype.");
  129.     }
  130.  
  131.     /**
  132.      * Test of getStudentEmail method, of class Student.
  133.      */
  134.     @Test
  135.     public void testGetStudentEmail() {
  136.         System.out.println("getStudentEmail");
  137.         Student instance = new Student();
  138.         String expResult = "marken@manager.com";
  139.         instance.setStudentEmail("marken@manager.com");
  140.         String result = instance.getStudentEmail();
  141.         assertEquals(expResult, result);
  142.         // TODO review the generated test code and remove the default call to fail.
  143.         //fail("The test case is a prototype.");
  144.     }
  145.    
  146.       /**
  147.      * Test of setStudentEmail method, of class Student.
  148.      */
  149.     @Test
  150.     public void testSetStudentEmail() {
  151.         System.out.println("setStudentEmail");
  152.         Student instance = new Student();
  153.         System.out.println("\tBefore Set: " + instance.getStudentEmail());
  154.        
  155.         instance.setStudentEmail("marken@manager.com");
  156.         System.out.println("\tAfter Set: " + instance.getStudentEmail());
  157.         // TODO review the generated test code and remove the default call to fail.
  158.         //fail("The test case is a prototype.");
  159.     }
  160.  
  161.     /**
  162.      * Test of getStudentBirth method, of class Student.
  163.      */
  164.     @Test
  165.     public void testGetStudentBirth() {
  166.         System.out.println("getStudentBirth");
  167.         Student instance = new Student();
  168.         String expResult = "28/08/1998";
  169.         instance.setStudentBirth("28/08/1998");
  170.         String result = instance.getStudentBirth();
  171.         assertEquals(expResult, result);
  172.         // TODO review the generated test code and remove the default call to fail.
  173.         //fail("The test case is a prototype.");
  174.     }
  175.  
  176.     /**
  177.      * Test of setStudentBirth method, of class Student.
  178.      */
  179.     @Test
  180.     public void testSetStudentBirth() {
  181.         System.out.println("setStudentBirth");
  182.         Student instance = new Student();
  183.         System.out.println("\tBefore Set: "+instance.getStudentBirth());
  184.         instance.setStudentBirth("28/08/1998");
  185.         System.out.println("\tAfter Set: "+instance.getStudentBirth());
  186.         // TODO review the generated test code and remove the default call to fail.
  187.         //fail("The test case is a prototype.");
  188.     }
  189.  
  190.  
  191.  
  192.     /**
  193.      * Test of getStudentAddress method, of class Student.
  194.      */
  195.     @Test
  196.     public void testGetStudentAddress() {
  197.         System.out.println("getStudentAddress");
  198.         Student instance = new Student();
  199.         String expResult = "bs347jz";
  200.         instance.setStudentAddress("bs347jz");
  201.         String result = instance.getStudentAddress();
  202.         assertEquals(expResult, result);
  203.         // TODO review the generated test code and remove the default call to fail.
  204.         //fail("The test case is a prototype.");
  205.     }
  206.  
  207.     /**
  208.      * Test of setStudentAddress method, of class Student.
  209.      */
  210.     @Test
  211.     public void testSetStudentAddress() {
  212.         System.out.println("setStudentAddress");
  213.         Student instance = new Student();
  214.         System.out.println("\tBefore Set: "+instance.getStudentAddress());
  215.         instance.setStudentAddress("Filton Avenue");
  216.         System.out.println("\tAfter Set: "+instance.getStudentAddress());
  217.         // TODO review the generated test code and remove the default call to fail.
  218.         //fail("The test case is a prototype.");
  219.     }
  220.    
  221. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement