Below is an example of an application.properties file:
spring.application.name=TaskManager
spring.datasource.url=jdbc:sqlite:tasks.db
spring.datasource.driver-class-name=org.sqlite.JDBC
spring.datasource.username=
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.community.dialect.SQLiteDialect
spring.jpa.hibernate.ddl-auto=updateExample of an application-test.properties file:
# Enable H2 in-memory database
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=
spring.datasource.password=
# Use H2 dialect for Hibernate
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
# Automatically create and drop schema
spring.jpa.hibernate.ddl-auto=create-dropTo test the provided endpoints:
- Make the scripts executable:
chmod u+x test-api-* - Test the /tasks GET method:
- Get all tasks:
./test-api-get.sh
- Get a single task with
id./test-api-get.sh [id]
- Get all tasks:
- Test the /tasks POST method (will create a new task with the title "test-task"):
./test-api-post.sh
- Test the /tasks PUT method (will change the title of the task with the provided
id):./test-api-put.sh [id]
- Test the /tasks DELETE method (will delete the task with the provided
id):./test-api-put.sh [id]