This project is a coding challenge for ALJ.
Please first look at my Nodejs Challenge
- Read how to unit test Spring Boot app.
- I wrote unit test for EmployeeController, and renamed/fixed things.
- I wrote unit test for EmployeeServiceImpl.
- I wrote e2e test for all API endpoints
- Added login with Hardcoded foo:bar user
- JWT authentication on
employees
endpoints - Added authentication e2e test
For the test sake, I wanted to implement JWT authentication, not a whole Users management system. This is why the user is hardcoded into the HardCodedUserService
.
- Add user management and remove hardcoded foo:bar user
- Unit test
JwtRequestFilter
andJwtService
as they are only tested implicitly via e2e tests - File and package architecture. For example, I feel like
SecurityConfigurer
doesn't belong in theservices
package, yet examples I've seen around put it here... - Upgrade to Junit5 to use
@Order
annotation in test instead of using alphabetical order JwtRequestFilter
readability
It was my first time using Java. Yes, you read that right, no missing words. I'm used to Javascript/Typescript.
However, I strongly believe that the language I use is irrelevant, as long as it is Object-Oriented.
Why ?
2 years ago I started a journey to become a Software Craftsman, all the things I learn and practice along the way apply to every OOP languages.
I might not know every method of the ArrayList
class, but I am trying my best to write clean code as defined by Robert C Martin.
I try to stick to Karma Convention spec :
<type>(scope): <description>
[optional body]
[optional footer(s)]
- Install packages with
mvn package
- Run
mvn spring-boot:run
for starting the application (or use your IDE)
Application (with the embedded H2 database) is ready to be used ! You can access the url below for testing it :
- Swagger UI : http://localhost:8080/swagger-ui.html
- H2 UI : http://localhost:8080/h2-console
Don't forget to set the
JDBC URL
value asjdbc:h2:mem:testdb
for H2 UI.
-
download the zip file of this project
-
create a repository in your own github named 'java-challenge'
-
clone your repository in a folder on your machine
-
extract the zip file in this folder
-
commit and push
-
Enhance the code in any ways you can see, you are free! Some possibilities:
- Add tests
- Change syntax
- Protect controller end points
- Add caching logic for database calls
- Improve doc and comments
- Fix any bug you might find
-
Edit readme.md and add any comments. It can be about what you did, what you would have done if you had more time, etc.
-
Send us the link of your repository.
- use java 8
- Readability of your code
- Documentation
- Comments in your code
- Appropriate usage of spring boot
- Appropriate usage of packages
- Is the application running as expected
- No performance issues