Search in sources :

Example 1 with HasName

use of com.tngtech.archunit.core.domain.properties.HasName in project github-api by hub4j.

the class ArchTests method testRequireUseOfAssertThat.

@Test
public void testRequireUseOfAssertThat() {
    final String reason = "This project uses `assertThat(...)` or `assertThrows(...)` instead of other `assert*()` methods.";
    final DescribedPredicate<HasName> assertMethodOtherThanAssertThat = nameContaining("assert").and(DescribedPredicate.not(name("assertThat")).and(DescribedPredicate.not(name("assertThrows"))));
    final ArchRule onlyAssertThatRule = classes().should(not(callMethodWhere(target(assertMethodOtherThanAssertThat)))).because(reason);
    onlyAssertThatRule.check(testClassFiles);
}
Also used : ArchRule(com.tngtech.archunit.lang.ArchRule) HasName(com.tngtech.archunit.core.domain.properties.HasName) Test(org.junit.Test)

Aggregations

HasName (com.tngtech.archunit.core.domain.properties.HasName)1 ArchRule (com.tngtech.archunit.lang.ArchRule)1 Test (org.junit.Test)1