Created
March 13, 2012 01:16
-
-
Save varokas/2025991 to your computer and use it in GitHub Desktop.
DAO-Business
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface StudentDAO { | |
public Iterable<Student> getStudentsByClass(String cls); | |
} | |
class StudentDAOTest { | |
//mock: Database (or use in-memory database) | |
//test that SQL works and queries the right thing | |
@Test public void testGetStudentByClassReturnsAllStudentsInClass() {} | |
@Test public void testGetStudentByClassThrowsExceptionWhenClassIsNull() {} | |
} | |
class StudentBusiness { | |
private StudentDao studentDao; | |
public Iterable<String> getGrades(String cls) { | |
students = studentDao.getStudentsByClass(cls); | |
//process grades and returns | |
} | |
} | |
class StudentBusinessTest { | |
//mock: StudentDao (supposed that StudentDao returns correct answer) | |
//test that the grading method works | |
@Test public void testGetGradesAssignsAToStudentWithScoreOf80OrMore(); | |
@Test public void testGetGradesAssignsBToStudentWithScoreOf60OrMore(); | |
... | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment