Skip to content

Commit

Permalink
archunit
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 13, 2025
1 parent 7abb925 commit 2b0f895
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
6 changes: 6 additions & 0 deletions eo-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ SOFTWARE.
<artifactId>jping</artifactId>
<!-- version from parent POM -->
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit</artifactId>
<version>1.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2025 Objectionary.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven;

import com.tngtech.archunit.core.importer.ClassFileImporter;
import com.tngtech.archunit.lang.syntax.ArchRuleDefinition;
import org.junit.jupiter.api.Test;

/**
* Test case for architectural conventions.
*
* @since 0.51.0
*/
@SuppressWarnings({ "JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleAssertionMessage" })
final class ArchitectureTest {

@Test
void mojosAreInPlace() {
ArchRuleDefinition.classes()
.that().haveSimpleNameEndingWith("Mojo")
.and().doNotHaveSimpleName("SafeMojo")
.should().resideInAPackage("org.eolang.maven")
.andShould().bePublic()
.check(new ClassFileImporter().importPackages("org.eolang.maven"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void failsOnTimeout(@Mktmp final Path temp) {
() -> new FakeMaven(temp)
.withHelloWorld()
.with("timeout", 0)
.execute(InfiniteMojo.class),
.execute(Infinite.class),
CatalogsTest.TO_ADD_MESSAGE
);
}
Expand Down Expand Up @@ -229,7 +229,7 @@ void parsesConcurrentlyWithLotsOfPrograms(@Mktmp final Path temp) throws IOExcep
* @since 0.29
*/
@Mojo(name = "infinite", defaultPhase = LifecyclePhase.VALIDATE)
private static final class InfiniteMojo extends SafeMojo {
private static final class Infinite extends SafeMojo {
@Override
public void exec() {
try {
Expand Down

0 comments on commit 2b0f895

Please sign in to comment.