Skip to content

acocinas/S104Testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Java Testing with JUnit

📌 Description

This project focuses on implementing and testing various functionalities using JUnit.

In this project Maven has been used to create and use the necessary dependencies.

The language used was Java (jdk23).

It has been carried out in the IntelliJ IDE


📝Level 1: JUnit

Exercise 1: Library Book Collection Management

Create a Java class to manage a collection of books in a library. The class should allow the following operations:

Functionalities:

  • Add books to the collection.
  • Retrieve the complete list of books.
  • Get the title of a book by its position.
  • Insert a book at a specific position.
  • Remove a book by title.

JUnit Tests:

  • Verify that the book list is not null after creating a new object.
  • Ensure the list has the expected size after adding multiple books.
  • Confirm that a specific book is in the correct position.
  • Ensure that there are no duplicate book titles in the list.
  • Check that a book title can be retrieved by its specific position.
  • Verify that adding a book correctly modifies the list.
  • Confirm that removing a book decreases the list size.
  • Ensure that the list remains sorted alphabetically after adding or removing a book.

Exercise 2: DNI Letter Calculation

Create a class named CalculoDni that calculates the letter of a Spanish DNI (National Identification Number) based on its number.

JUnit Tests:

  • Implement a JUnit test class that validates its functionality.
  • Parameterize the test to receive a broad range of data.
  • Validate the correct letter calculation for 10 predefined DNI numbers.

Exercise 3: Exception Handling

Create a class with a method that throws an ArrayIndexOutOfBoundsException.

JUnit Tests:

  • Verify its correct handling with a JUnit test.

Notes

  • Code must be written in English.
  • Ensure all tests follow best practices.
  • Use meaningful assertions to validate expected behavior.

📝 Clone the repository

🎯 Target

  • Learn and practice about Testing.
  • Apply best practices in the development and management of GitHub repositories.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages