name: portada class: portada-slide, center, middle # Test de funcions .footnote[Joan Puigcerver Ibáñez] --- layout: true class: regular-slide .right[.logo[]] --- # Test de funcions - Com podem mirar que una funció funciona correctament? - Test unitari - JUnit --- # Test de funcions - Exemple ``` public static int suma(int a, int b){ return a+b; } ``` --- # Exemple - test ``` @Test public void testSuma() throws Exception { assertEquals(6, Exemple1.suma(2,4)); assertEquals(210, Exemple1.suma(10, 200)); } ``` --- # Debug - Podem també usar l'eina de debugar per analitzar una funció --- # Excepcions - NullPointerException - OutOfBounds - OutOfMemoryError TODO: exemples