Last active
August 29, 2015 14:05
-
-
Save up1/4fe837903f8deaeff2a5 to your computer and use it in GitHub Desktop.
Demo :: TDD with Security
This file contains 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
@Test | |
public void attack_with_sql_injection_to_table_person_should_return_all_data() { | |
PersonDAO personDAO = new PersonDAO(getDataSource()); | |
List<Person> persons = personDAO.getPerson("'or '1'='1"); | |
assertEquals(5, persons.size()); | |
} |
This file contains 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
@Test(expected = DataNotFoundException.class) | |
public void attack_with_sql_injection_to_table_person_should_return_data_not_found() { | |
PersonDAO personDAO = new PersonDAO(getDataSource()); | |
personDAO.getPerson("'or '1'='1"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment