Discovering problems Questions 1. Describe the steps that should be followed in order to create a Junit to test a given class. 2. What should be done in a Unit test class to be sure that all the tests methods can be run be a simple main call? 3. How should be compiled a source code to enable assertion mechanism? 4. How should be run a class to be sure that the assertions are executed? 5. How you can get the "root" logger? 6. Which is the default level for each handler? 7. Which is the relation between loggers and handlers? 3.12.2 Problems 1. Create a class containing a static clause that throws an exception if assertions are not enabled. Demonstrate that this test works correctly. 2. Create a Triangle class. The class attributes represents the length of the triangle's sides. The class is able to determine the type of the triangle: scalene, isosceles and equilateral. Write a unit test that you feeel adequately to test this class.
Write an example using Handlers and Filters to log messages with
any severity level over INFO in one file and any severity level including and
below INFO in other file. The files should be written in simple text.
Va rog sa
folositi Ant, Log4J si JUnit.
In proiectul
ANT va rog
sa apara urmatoarele targets:
init
build
dist
clean
doc
build_tests
run_tests
report
Deci ce inseamna fiecare target in ANT: - init: initializare de proprietati, creare de directoare, etc. - build: compilare, copiere de fisiere, patch de fisiere - dist: pregatire jar, war, etc. - doc: pregatire javadoc si alte documentatii - clean: cleanup - build_tests: compilare de unit tests - run_tests: executie de unit tests - report: generare raport de executie unit tests din fisierele XML produse de JUnit