Search in sources :

Example 6 with OnionArchitecture

use of com.tngtech.archunit.library.Architectures.OnionArchitecture in project ArchUnit by TNG.

the class ArchitecturesTest method onion_architecture_rejects_empty_layers_if_layers_are_explicitly_not_optional_by_default.

@Test
public void onion_architecture_rejects_empty_layers_if_layers_are_explicitly_not_optional_by_default() {
    OnionArchitecture architecture = anOnionArchitectureWithEmptyLayers().withOptionalLayers(false);
    JavaClasses classes = new ClassFileImporter().importPackages(absolute("onionarchitecture"));
    EvaluationResult result = architecture.evaluate(classes);
    assertFailureOnionArchitectureWithEmptyLayers(result);
}
Also used : JavaClasses(com.tngtech.archunit.core.domain.JavaClasses) OnionArchitecture(com.tngtech.archunit.library.Architectures.OnionArchitecture) EvaluationResult(com.tngtech.archunit.lang.EvaluationResult) ClassFileImporter(com.tngtech.archunit.core.importer.ClassFileImporter) Test(org.junit.Test)

Example 7 with OnionArchitecture

use of com.tngtech.archunit.library.Architectures.OnionArchitecture in project ArchUnit by TNG.

the class ArchitecturesTest method onion_architecture_description.

@Test
public void onion_architecture_description() {
    OnionArchitecture architecture = onionArchitecture().domainModels("onionarchitecture.domain.model..").domainServices("onionarchitecture.domain.service..").applicationServices("onionarchitecture.application..").adapter("cli", "onionarchitecture.adapter.cli..").adapter("persistence", "onionarchitecture.adapter.persistence..").adapter("rest", "onionarchitecture.adapter.rest.command..", "onionarchitecture.adapter.rest.query..");
    assertThat(architecture.getDescription()).isEqualTo("Onion architecture consisting of" + lineSeparator() + "domain models ('onionarchitecture.domain.model..')" + lineSeparator() + "domain services ('onionarchitecture.domain.service..')" + lineSeparator() + "application services ('onionarchitecture.application..')" + lineSeparator() + "adapter 'cli' ('onionarchitecture.adapter.cli..')" + lineSeparator() + "adapter 'persistence' ('onionarchitecture.adapter.persistence..')" + lineSeparator() + "adapter 'rest' ('onionarchitecture.adapter.rest.command..', 'onionarchitecture.adapter.rest.query..')");
}
Also used : OnionArchitecture(com.tngtech.archunit.library.Architectures.OnionArchitecture) Test(org.junit.Test)

Example 8 with OnionArchitecture

use of com.tngtech.archunit.library.Architectures.OnionArchitecture in project ArchUnit by TNG.

the class ArchitecturesTest method onion_architecture_description_with_missing_layers.

@Test
public void onion_architecture_description_with_missing_layers() {
    OnionArchitecture architecture = onionArchitecture();
    assertThat(architecture.getDescription()).isEqualTo("Onion architecture consisting of");
}
Also used : OnionArchitecture(com.tngtech.archunit.library.Architectures.OnionArchitecture) Test(org.junit.Test)

Aggregations

OnionArchitecture (com.tngtech.archunit.library.Architectures.OnionArchitecture)8 Test (org.junit.Test)8 JavaClasses (com.tngtech.archunit.core.domain.JavaClasses)5 ClassFileImporter (com.tngtech.archunit.core.importer.ClassFileImporter)5 EvaluationResult (com.tngtech.archunit.lang.EvaluationResult)5