test(deploy): autowire repository in snapshot IT (JavaTimeModule-safe)
Replace manual `new PostgresDeploymentRepository(jdbcTemplate, new ObjectMapper())` with `@Autowired PostgresDeploymentRepository repository` to use the Spring-managed bean whose ObjectMapper has JavaTimeModule registered. Also removes the redundant isNotNull() assertion whose work is done by the field-level assertions that follow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,10 +4,10 @@ import com.cameleer.common.model.ApplicationConfig;
|
||||
import com.cameleer.server.app.AbstractPostgresIT;
|
||||
import com.cameleer.server.core.runtime.Deployment;
|
||||
import com.cameleer.server.core.runtime.DeploymentConfigSnapshot;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@@ -16,7 +16,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class PostgresDeploymentRepositoryIT extends AbstractPostgresIT {
|
||||
|
||||
private PostgresDeploymentRepository repository;
|
||||
@Autowired PostgresDeploymentRepository repository;
|
||||
|
||||
private UUID envId;
|
||||
private UUID appId;
|
||||
@@ -24,8 +24,6 @@ class PostgresDeploymentRepositoryIT extends AbstractPostgresIT {
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
repository = new PostgresDeploymentRepository(jdbcTemplate, new ObjectMapper());
|
||||
|
||||
envId = UUID.randomUUID();
|
||||
jdbcTemplate.update(
|
||||
"INSERT INTO environments (id, slug, display_name) VALUES (?, ?, ?)",
|
||||
@@ -73,7 +71,6 @@ class PostgresDeploymentRepositoryIT extends AbstractPostgresIT {
|
||||
Deployment loaded = repository.findById(deploymentId).orElseThrow();
|
||||
|
||||
// then
|
||||
assertThat(loaded.deployedConfigSnapshot()).isNotNull();
|
||||
assertThat(loaded.deployedConfigSnapshot().jarVersionId()).isEqualTo(jarVersionId);
|
||||
assertThat(loaded.deployedConfigSnapshot().agentConfig().getSamplingRate()).isEqualTo(0.5);
|
||||
assertThat(loaded.deployedConfigSnapshot().containerConfig()).containsEntry("memoryLimitMb", 1024);
|
||||
|
||||
Reference in New Issue
Block a user