Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gmitaros committed Oct 6, 2024
1 parent c3ff0b8 commit 6ad2ea6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.gmitaros.vesselmetrics.dto.ComplianceComparisonResponseDTO;
import com.gmitaros.vesselmetrics.exception.VesselNotFoundException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
Expand All @@ -22,11 +21,6 @@ class VesselComplianceServiceIntegrationTest {
@Autowired
private VesselComplianceService vesselComplianceService;

@BeforeEach
void setUp() {
// Any setup before the test cases if needed.
}

@Test
void testCompareVesselCompliance_ValidVessels() {
String vesselCode1 = "3001";
Expand All @@ -37,7 +31,7 @@ void testCompareVesselCompliance_ValidVessels() {
assertNotNull(response);
assertEquals(vesselCode1, response.getVesselCode1());
assertEquals(vesselCode2, response.getVesselCode2());
assertEquals(-217.32789972602322, response.getCompliance1(), 0.01, "Compliance 1 is incorrect");
assertEquals(-219.60153732307575, response.getCompliance1(), 0.01, "Compliance 1 is incorrect");
assertEquals(2.148288849167802, response.getCompliance2(), 0.01, "Compliance 2 is incorrect");
assertEquals(response.getResult(), "19310 is more compliant.");
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ vessel.metrics.outlier.batch.size=10000
spring.datasource.url=jdbc:h2:mem:test;MODE=PostgreSQL;DB_CLOSE_DELAY=-1
spring.datasource.username=sa
spring.datasource.password=
spring.flyway.locations=classpath:db/migration,classpath:db/migration-test
spring.flyway.clean-on-validation-error=true

# Disable Spring Boot's automatic DDL generation
spring.jpa.hibernate.ddl-auto=none
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SET REFERENTIAL_INTEGRITY FALSE;
TRUNCATE TABLE vessel_data_validation_errors;
TRUNCATE TABLE vessel_data;
SET REFERENTIAL_INTEGRITY TRUE;

0 comments on commit 6ad2ea6

Please sign in to comment.