Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

teste #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ spring.datasource.hikari.connectionTimeout=20000
spring.datasource.hikari.maximumPoolSize=5

## PostgreSQL
spring.datasource.url=jdbc:postgresql://${DATABASE_HOST:127.0.0.1}:${DATABASE_PORT:5433}/tasks
spring.datasource.url=jdbc:postgresql://${DATABASE_HOST:192.168.0.17}:${DATABASE_PORT:5433}/tasks
spring.datasource.username=${DATABASE_USER:postgres}
spring.datasource.password=${DATABASE_PASSWD:password}

#drop n create table again, good for testing, comment this in production
spring.jpa.hibernate.ddl-auto=${DATABASE_UPDATE:create}
#spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
31 changes: 31 additions & 0 deletions src/test/java/br/ce/wcaquino/taskbackend/utils/DateUtilsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package br.ce.wcaquino.taskbackend.utils;

import java.time.LocalDate;

import org.junit.Assert;
import org.junit.Test;

public class DateUtilsTest {

@Test
public void deveRetornarTrueParaDatasFuturas() {
LocalDate date = LocalDate.of(2023, 01, 01);
DateUtils.isEqualOrFutureDate(date);
Assert.assertTrue(DateUtils.isEqualOrFutureDate(date));
}


@Test
public void deveRetornarFalseParaDatasPassadas() {
LocalDate date = LocalDate.of(2010, 01, 01);
DateUtils.isEqualOrFutureDate(date);
Assert.assertFalse(DateUtils.isEqualOrFutureDate(date));
}

@Test
public void deveRetornarTrueParaDatasAtual() {
LocalDate date = LocalDate.now();
Assert.assertTrue(DateUtils.isEqualOrFutureDate(date));
}

}