-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add config test and secret for managed identity
- Loading branch information
1 parent
3c8aab5
commit bad459d
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/test/java/it/gov/pagopa/rtp/activator/configuration/CosmosDBConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package it.gov.pagopa.rtp.activator.configuration; | ||
|
||
import com.azure.cosmos.CosmosClientBuilder; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
|
||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.mockito.Mockito.lenient; | ||
import static org.mockito.Mockito.verify; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class CosmosDBConfigTest { | ||
|
||
@Mock | ||
private CosmosPropertiesConfig cosmosPropertiesConfig; | ||
|
||
@InjectMocks | ||
private CosmosDBConfig cosmosDBConfig; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
lenient().when(cosmosPropertiesConfig.getDbName()).thenReturn("test-db"); | ||
lenient().when(cosmosPropertiesConfig.getEndpoint()).thenReturn("https://test-endpoint:443/"); | ||
} | ||
|
||
@Test | ||
void testGetDatabaseName() { | ||
String dbName = cosmosDBConfig.getDatabaseName(); | ||
assertEquals("test-db", dbName); | ||
} | ||
|
||
@Test | ||
void testGetCosmosClientBuilder() { | ||
CosmosClientBuilder builder = cosmosDBConfig.getCosmosClientBuilder(); | ||
verify(cosmosPropertiesConfig).getEndpoint(); | ||
assertNotNull(builder); | ||
} | ||
} |