Search in sources :

Example 16 with ConfigurationUnit

use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.

the class DefaultConfigurationReaderTest method shouldReturnErrorWhenClassDoesNotMatch.

@Test
public void shouldReturnErrorWhenClassDoesNotMatch() {
    Assertions.assertThrows(ConfigurationException.class, () -> {
        ConfigurationUnit annotation = mock(ConfigurationUnit.class);
        when(annotation.fileName()).thenReturn("invalid-class.json");
        when(annotation.name()).thenReturn("name");
        configurationReader.read(annotation, MockConfiguration.class);
    });
}
Also used : ConfigurationUnit(org.jnosql.artemis.ConfigurationUnit) Test(org.junit.jupiter.api.Test)

Example 17 with ConfigurationUnit

use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.

the class DefaultConfigurationReaderTest method shouldReturnErrorWhenUnitNameIsNotFind.

@Test
public void shouldReturnErrorWhenUnitNameIsNotFind() {
    Assertions.assertThrows(ConfigurationException.class, () -> {
        ConfigurationUnit annotation = mock(ConfigurationUnit.class);
        when(annotation.fileName()).thenReturn("jnosql.json");
        when(annotation.name()).thenReturn("unknown");
        configurationReader.read(annotation, MockConfiguration.class);
    });
}
Also used : ConfigurationUnit(org.jnosql.artemis.ConfigurationUnit) Test(org.junit.jupiter.api.Test)

Example 18 with ConfigurationUnit

use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.

the class DefaultConfigurationReaderTest method shouldReturnErrorWhenClassIsNotFound.

@Test
public void shouldReturnErrorWhenClassIsNotFound() {
    Assertions.assertThrows(ConfigurationException.class, () -> {
        ConfigurationUnit annotation = mock(ConfigurationUnit.class);
        when(annotation.fileName()).thenReturn("invalid-class.json");
        when(annotation.name()).thenReturn("name-1");
        configurationReader.read(annotation, MockConfiguration.class);
    });
}
Also used : ConfigurationUnit(org.jnosql.artemis.ConfigurationUnit) Test(org.junit.jupiter.api.Test)

Example 19 with ConfigurationUnit

use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.

the class DefaultConfigurationReaderTest method shouldReturnAnErrorWhenTheFileIsInvalid.

@Test
public void shouldReturnAnErrorWhenTheFileIsInvalid() {
    Assertions.assertThrows(ConfigurationException.class, () -> {
        ConfigurationUnit annotation = mock(ConfigurationUnit.class);
        when(annotation.fileName()).thenReturn("invalid");
        configurationReader.read(annotation, MockConfiguration.class);
    });
}
Also used : ConfigurationUnit(org.jnosql.artemis.ConfigurationUnit) Test(org.junit.jupiter.api.Test)

Example 20 with ConfigurationUnit

use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.

the class DefaultJSONConfigurationreaderTest method shouldReturnErrorWhenFileIsInvalid.

@Test
public void shouldReturnErrorWhenFileIsInvalid() {
    Assertions.assertThrows(ConfigurationException.class, () -> {
        ConfigurationUnit annotation = mock(ConfigurationUnit.class);
        when(annotation.fileName()).thenReturn("invalid.json");
        configurationReader.read(annotation, MockConfiguration.class);
    });
}
Also used : ConfigurationUnit(org.jnosql.artemis.ConfigurationUnit) Test(org.junit.jupiter.api.Test)

Aggregations

ConfigurationUnit (org.jnosql.artemis.ConfigurationUnit)24 Test (org.junit.jupiter.api.Test)19 ConfigurationSettingsUnit (org.jnosql.artemis.ConfigurationSettingsUnit)12 HashMap (java.util.HashMap)7 Annotated (javax.enterprise.inject.spi.Annotated)5 ColumnConfiguration (org.jnosql.diana.api.column.ColumnConfiguration)1 ColumnConfigurationAsync (org.jnosql.diana.api.column.ColumnConfigurationAsync)1 DocumentConfiguration (org.jnosql.diana.api.document.DocumentConfiguration)1 DocumentConfigurationAsync (org.jnosql.diana.api.document.DocumentConfigurationAsync)1 KeyValueConfiguration (org.jnosql.diana.api.key.KeyValueConfiguration)1