Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaconsalvi committed Nov 27, 2024
1 parent bad459d commit aeb104a
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ cosmos.credential.db-name=${DB_NAME:rtp}
cosmos.credential.endpoint=${COSMOS_ACCOUNT_RTP_ENDPOINT:}


activation.base-url=${BASE_URL:"http://localhost"}
activation.base-url=${BASE_URL:http://localhost}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package it.gov.pagopa.rtp.activator.configuration;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@ExtendWith(SpringExtension.class)
@EnableConfigurationProperties(value = ActivationPropertiesConfig.class)
@TestPropertySource("classpath:application.properties")
class ActivationPropertiesConfigTest {

@Autowired
private ActivationPropertiesConfig activationPropertiesConfig;

@Test
void testPropertiesLoaded() {
assertNotNull(activationPropertiesConfig);
assertEquals("https://example.com", activationPropertiesConfig.getBaseUrl());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package it.gov.pagopa.rtp.activator.configuration;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;

@ExtendWith(SpringExtension.class)
@EnableConfigurationProperties(value = CosmosPropertiesConfig.class)
@TestPropertySource("classpath:application.properties")
public class CosmosPropertiesConfigTest {

@Autowired
private CosmosPropertiesConfig cosmosPropertiesConfig;

@Test
void testPropertiesLoaded() {
assertNotNull(cosmosPropertiesConfig);
assertEquals("https://example.com/db/endpoint", cosmosPropertiesConfig.getEndpoint());
assertEquals("rtp", cosmosPropertiesConfig.getDbName());

}
}
6 changes: 6 additions & 0 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
logging.level.org.springframework.security=DEBUG
activation.baseUrl=https://example.com


cosmos.credential.db-name=rtp
cosmos.credential.endpoint=https://example.com/db/endpoint

0 comments on commit aeb104a

Please sign in to comment.