Project · Java Programming (Core to Spring Boot)
Project: a tested UPI ledger with JDBC
The brief
You build the money core of a small UPI-style wallet service as a Maven project: an Account that never overspends, a VPA validator written test-first, a JDBC ledger on an H2 database that moves money in one transaction, and a test that fires ten thousand payments at once on virtual threads.
Why it matters
Payment companies, banks and NBFCs hire Java developers for exactly this: code where a lost paisa is a bug report from the regulator. Money in paise, PreparedStatement for every query, commit-or-rollback transfers, thread-safe balances and a suite of tests that proves it are what interviewers and code reviewers at fintech firms look for.
Skills you practise
- Maven project layout and pom.xml
- JUnit 5 assertions and assertThrows
- parameterized tests
- test-first (red, green)
- JDBC with PreparedStatement
- transactions: commit and rollback
- synchronized and virtual threads
- mvn package and exec:java
You need
- JDK 21 or newer (this project uses virtual threads, which need Java 21)
- Apache Maven 3.9 or newer on your PATH (mvn -v works), or the Maven Wrapper (mvnw) in the project
- A text editor or IDE (VS Code with the Extension Pack for Java, or IntelliJ IDEA Community Edition) and a terminal
- Internet access the first time, so Maven can download H2, JUnit and the plugins
What you will have at the end
The upi-ledger Maven project (pom.xml, five main classes, five test classes, a README) with 18 passing tests, the demo output and the packaged JAR. It is a good repository to link from a CV for fintech roles.
How it is marked (rubric, 100 points)
| Correct and testedAll 18 tests pass every run; the demo shows money conserved after failed transfers. | 40 |
|---|---|
| Safe data accessEvery value goes through PreparedStatement parameters; every JDBC object is closed with try-with-resources; transfers commit or roll back as one. | 20 |
| Thread safetyThe balance can only change inside synchronized methods; you can explain the race the test catches. | 15 |
| Testing disciplineVpaTest was written first and seen failing; tests have names that read like sentences. | 15 |
| Project hygieneStandard Maven layout, pinned versions, a README, and no target/ folder in Git. | 10 |
0/7 steps done
Step 1 of 7
Set up the Maven project
mvn -v shows Maven 3.9 or newer running on Java 21 or newer, and the project folder has the standard layout.
Make a folder upi-ledger with pom.xml at the top, the application classes in src/main/java/com/upi/ledger/ and the test classes (every *Test.java) in src/test/java/com/upi/ledger/. Copy in only pom.xml, the main classes and AccountTest for now; you add each other test file at its step. Maven reads pom.xml, downloads H2 and JUnit into ~/.m2 and uses the JDK that JAVA_HOME points to, which is what mvn -v reports.
upi-ledger/
├── pom.xml
├── src/main/java/com/upi/ledger/ Account, InsufficientFundsException, Vpa, JdbcLedger, Demo
└── src/test/java/com/upi/ledger/ AccountTest (more tests added later)$ mvn -vAlso check yourself
Your notes: pom.xml, Account.java, Vpa.java, VpaTest.java, JdbcLedger.java
Write down each command you ran. It goes into your project summary.