https://github.com/fcbento/java-junit-oop-study-case
Java console-based library management system with user, book, and loan management, featuring unit and E2E tests with high coverage
https://github.com/fcbento/java-junit-oop-study-case
jacoco java junit5 maven mockito
Last synced: 29 days ago
JSON representation
Java console-based library management system with user, book, and loan management, featuring unit and E2E tests with high coverage
- Host: GitHub
- URL: https://github.com/fcbento/java-junit-oop-study-case
- Owner: fcbento
- Created: 2025-08-23T03:26:32.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-23T04:38:42.000Z (10 months ago)
- Last Synced: 2025-09-03T14:12:33.156Z (10 months ago)
- Topics: jacoco, java, junit5, maven, mockito
- Language: Java
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Library Management System

## Description
This project is a smalll **library management system** built in Java. It is built to practice some of the oop concepts as it's been kind of a while I don't actually pay due attention to them. Like both polymorphism and abstraction for example. There's definitely though a lot to build in this project yet as I covered only the basics for now. It's been fun playing a little with ``` Scanner(System.in)``` and ```System.out.println()```again. It felt a lot like university.
Current features are:
- Create users
- Loan books
- See loaned books
- List available books
The project uses model, repository, service, controller, and view layers for a more clean structure.
---
## Project Structure
```text
src/main/java/com/library
├── controller # System controllers
├── enums # Enums used in the system
├── model # Data models
├── repository # Data storage
├── service # Business logic
├── util # Utilities (e.g., BookGenerator to display random books)
└── view # Console interfaces
```
```text
src/test/java/com/library
├── controller # Controller unit tests
├── repository # Repository unit tests
├── service # Service unit tests
└── view # Console integration e2e
```
---
## How to Run
1. Clone the repository and run the project:
```bash
git clone https://github.com/fcbento/java-junit-oop-study-case.git
cd java-junit-oop-study-case
mvn compile
mvn exec:java -Dexec.mainClass="src.main.java.com.library.Main"
```
2. Run tests
```
mvn test
```
## Code coverage
| Package / Element | Instructions | Branches | Lines | Methods | Classes |
| ------------------------------------ | ------------ | -------- | ----- | ------- | ------- |
| src.main.java.com.library.model | 60% | 0% | 44 | 23 | 3 |
| src.main.java.com.library | 95% | 77% | 38 | 7 | 1 |
| src.main.java.com.library.view | 98% | 100% | 75 | 12 | 4 |
| src.main.java.com.library.util | 98% | 100% | 13 | 3 | 1 |
| src.main.java.com.library.repository | 100% | 100% | 29 | 13 | 3 |
| src.main.java.com.library.controller | 100% | n/a | 16 | 8 | 3 |
| src.main.java.com.library.service | 100% | n/a | 16 | 9 | 3 |
| src.main.java.com.library.enums | 100% | n/a | 5 | 1 | 1 |


## Technologies
- Java 17
- JUnit 5
- Mockito
- Maven
- JaCoCo
## Some notes
- Views were refactored to allow Scanner dependency injection, making automated testing possible.
- Data is stored in memory; there is no database persistence but maybe it wouldn't be a bad idea to plug the repository layer to an actual database.
- This project is only intended as a learning exercise for best practices, OOP, and mostly test coverage.
## Author
## Contact
[](https://linkedin.com/in/felipe-bento)
[](https://discordapp.com/users/413141379074490369)
[](mailto:felipe.16costa@gmail.com)