A Java-based testing framework for integer list operations, designed for automated unit testing using JUnit.
ListaUtil is a utility class for managing a dynamic list of integers, providing methods for adding, removing, and analyzing list contents. ListaUtilTest includes a suite of JUnit tests that validate all functionalities of ListaUtil under various conditions.
ListaUtil: Manages a list of integers with methods to add, remove, and perform calculations such as counting, summing, and finding the max and min values.ListaUtilTest: Implements JUnit tests to ensureListaUtilfunctions as expected. Each method inListaUtilis covered by multiple tests to validate its correctness across different scenarios.
- Add/Remove Operations: Safely add and remove integers, with special handling for
nullvalues. - Aggregate Information: Count total, even, and odd integers.
- Mathematical Calculations: Sum integers and find the largest and smallest values in the list.
- Duplication Check: Determine whether the list contains any duplicate integers.
- Comprehensive Testing: Each operation is rigorously tested to ensure reliability and accuracy.
add()Tests: Validate that adding integers (both positive and negative) updates the list size appropriately and that addingnulldoes not affect the list.remove()Tests: Ensure that removing an integer adjusts the list size correctly, and that removingnullor non-existent values does not alter the list size.count()Tests: Check the count functionality for both empty and populated lists.countPares()andcountImpares()Tests: Verify counting of even and odd numbers in various list states.somar()Tests: Assess the sum function with different sets of integers.getMaior()andgetMenor()Tests: Test for correct identification of the largest and smallest integers.hasDuplicidade()Tests: Check for duplicate values in the list to ensure the function accurately identifies duplicates or the absence thereof.
Integrate ListaUtil into any Java project where integer list management is needed. Use ListaUtilTest to validate functionality or as a reference for writing further tests with JUnit.