Skip to content

Commit

Permalink
test: add more tests to DynamoDBDocumentConfiguration
Browse files Browse the repository at this point in the history
Signed-off-by: Maximillian Arruda <[email protected]>
  • Loading branch information
Maximillian Arruda committed Dec 27, 2023
1 parent 378e91f commit 37edf9c
Showing 1 changed file with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,53 @@
package org.eclipse.jnosql.databases.dynamodb.communication;


import org.assertj.core.api.SoftAssertions;
import org.eclipse.jnosql.communication.document.DocumentConfiguration;
import org.eclipse.jnosql.communication.document.DocumentManagerFactory;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;

import static org.assertj.core.api.SoftAssertions.assertSoftly;
import static org.eclipse.jnosql.communication.driver.IntegrationTest.MATCHES;
import static org.eclipse.jnosql.communication.driver.IntegrationTest.NAMED;

@EnabledIfSystemProperty(named = NAMED, matches = MATCHES)
class DynamoDBDocumentConfigurationTest {

@Test
void shouldReturnFromConfiguration() {
void shouldReturnFromServiceLoaderConfiguration() {
var configuration = DocumentConfiguration.getConfiguration();
Assertions.assertNotNull(configuration);
Assertions.assertTrue(configuration instanceof DynamoDBDocumentConfiguration);
Assertions.assertInstanceOf(DynamoDBDocumentConfiguration.class, configuration);
}

@Test
void shouldReturnFromConfigurationQuery() {
void shouldReturnFromServiceLoaderConfigurationQuery() {
var configuration = DocumentConfiguration
.getConfiguration(DynamoDBDocumentConfiguration.class);
Assertions.assertNotNull(configuration);
Assertions.assertTrue(configuration instanceof DynamoDBDocumentConfiguration);
}

@Test
void shouldReturnDocumentManagerFactory() {
var configuration = DocumentConfiguration
.getConfiguration(DynamoDBDocumentConfiguration.class);

var settings = DynamoDBTestUtils.INSTANCE.getSettings();

assertSoftly(softly -> {
softly.assertThat(configuration)
.describedAs("DocumentConfiguration.getConfiguration(DynamoDBDocumentConfiguration.class) must return a non-null instance")
.isNotNull();

DocumentManagerFactory documentManagerFactory = configuration.apply(settings);

softly.assertThat(documentManagerFactory)
.describedAs("DynamoDBDocumentConfiguration.apply(Settings.class) should returns a non-null DocumentManagerFactory instance")
.isNotNull();

});
}

}

0 comments on commit 37edf9c

Please sign in to comment.