From df718a88c28df6f21b035351c275a226b863e4f2 Mon Sep 17 00:00:00 2001 From: Pascal Grimaud Date: Wed, 15 Dec 2021 12:04:12 +0100 Subject: [PATCH] Refactoring: rename Nested class --- .../tech/jhipster/lite/AnnotationArchTest.java | 9 +++++++-- .../lite/common/domain/FileUtilsTest.java | 18 +++++++++--------- .../lite/common/domain/WordUtilsTest.java | 8 ++++---- .../domain/BuildToolDomainServiceTest.java | 6 +++--- .../generator/project/domain/ProjectTest.java | 12 ++++++------ ...ringBootPropertiesApplicationServiceIT.java | 6 +++--- 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/test/java/tech/jhipster/lite/AnnotationArchTest.java b/src/test/java/tech/jhipster/lite/AnnotationArchTest.java index 307d7a6e7fa..08300e5a258 100644 --- a/src/test/java/tech/jhipster/lite/AnnotationArchTest.java +++ b/src/test/java/tech/jhipster/lite/AnnotationArchTest.java @@ -8,6 +8,7 @@ import com.tngtech.archunit.core.domain.JavaClasses; import com.tngtech.archunit.core.importer.ClassFileImporter; import com.tngtech.archunit.lang.ArchRule; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @UnitTest @@ -25,7 +26,9 @@ void shouldHaveUnitTestAnnotation() { .and() .haveSimpleNameEndingWith("Test") .should() - .beAnnotatedWith(UnitTest.class); + .beAnnotatedWith(UnitTest.class) + .orShould() + .beAnnotatedWith(Nested.class); rule.check(importedClasses); } @@ -40,7 +43,9 @@ void shouldHaveIntegrationTestAnnotation() { .and() .haveSimpleNameEndingWith("IT") .should() - .beAnnotatedWith(IntegrationTest.class); + .beAnnotatedWith(IntegrationTest.class) + .orShould() + .beAnnotatedWith(Nested.class); rule.check(importedClasses); } diff --git a/src/test/java/tech/jhipster/lite/common/domain/FileUtilsTest.java b/src/test/java/tech/jhipster/lite/common/domain/FileUtilsTest.java index 5202ab8d6b1..91c978ef1c8 100644 --- a/src/test/java/tech/jhipster/lite/common/domain/FileUtilsTest.java +++ b/src/test/java/tech/jhipster/lite/common/domain/FileUtilsTest.java @@ -27,7 +27,7 @@ class FileUtilsTest { @Nested - class Exists { + class ExistsTest { @Test void shouldExists() { @@ -52,7 +52,7 @@ void shouldNotExistsForBlank() { } @Nested - class CreateFolder { + class CreateFolderTest { @Test void shouldNotCreateFolderForNull() { @@ -96,7 +96,7 @@ void shouldNotCreateFolderWhenItsAFile() throws Exception { } @Nested - class GetPath { + class GetPathTest { @Test void shouldGetPath() { @@ -140,7 +140,7 @@ void shouldNotGetInputStream() { } @Nested - class Read { + class ReadTest { @Test void shouldRead() throws Exception { @@ -169,7 +169,7 @@ void shouldNotReadWhenFileNotExist() { } @Nested - class GetLine { + class GetLineTest { @Test void shouldGetLine() throws Exception { @@ -202,7 +202,7 @@ void shouldNotGetLineWhenFileNotExist() { } @Nested - class ContainsInLine { + class ContainsInLineTest { @Test void shouldContainsInLine() { @@ -227,7 +227,7 @@ void shouldNotContainsInLineWhenFilenameNotExist() { } @Nested - class ContainsLines { + class ContainsLinesTest { @Test void shouldContainsLinesSingle() { @@ -300,7 +300,7 @@ void shouldNotContainsLinesWithEmptyLines() { } @Nested - class Replace { + class ReplaceTest { @Test void shouldReplaceInFile() throws Exception { @@ -330,7 +330,7 @@ void shouldNotReplaceInFileWhenFileNotExist() { } @Nested - class FileSystem { + class FileSystemTest { @Test @EnabledOnOs(OS.WINDOWS) diff --git a/src/test/java/tech/jhipster/lite/common/domain/WordUtilsTest.java b/src/test/java/tech/jhipster/lite/common/domain/WordUtilsTest.java index 94ca7aac958..a0fea4ddd91 100644 --- a/src/test/java/tech/jhipster/lite/common/domain/WordUtilsTest.java +++ b/src/test/java/tech/jhipster/lite/common/domain/WordUtilsTest.java @@ -13,7 +13,7 @@ class WordUtilsTest { @Nested - class KebabCase { + class KebabCaseTest { @Test void shouldKebabCase() { @@ -41,7 +41,7 @@ void shouldNotKebabForBlank() { } @Nested - class UpperFirst { + class UpperFirstTest { @Test void shouldUpperFirst() { @@ -70,7 +70,7 @@ void shouldNotUpperFirstWithBlank() { } @Nested - class Indent { + class IndentTest { @Test void shouldIndent1Time() { @@ -99,7 +99,7 @@ void shouldNotIndentWithZero() { } @Nested - class IdentWithSpace { + class IdentWithSpaceTest { @Test void shouldIndent1TimeWith4spaces() { diff --git a/src/test/java/tech/jhipster/lite/generator/buildtool/generic/domain/BuildToolDomainServiceTest.java b/src/test/java/tech/jhipster/lite/generator/buildtool/generic/domain/BuildToolDomainServiceTest.java index 1df901e6959..c26804e8c3e 100644 --- a/src/test/java/tech/jhipster/lite/generator/buildtool/generic/domain/BuildToolDomainServiceTest.java +++ b/src/test/java/tech/jhipster/lite/generator/buildtool/generic/domain/BuildToolDomainServiceTest.java @@ -28,7 +28,7 @@ class BuildToolDomainServiceTest { BuildToolDomainService buildToolDomainService; @Nested - class Maven { + class MavenTest { @Test void shouldAddParent() { @@ -100,7 +100,7 @@ void shouldInitWihoutExistingPomXml() { } @Nested - class Gradle { + class GradleTest { @Test void shouldNotInit() { @@ -118,7 +118,7 @@ void shouldNotInitWithExistingGradle() { } @Nested - class NoBuildTool { + class NoBuildToolTest { @Test void shouldNotAddParent() { diff --git a/src/test/java/tech/jhipster/lite/generator/project/domain/ProjectTest.java b/src/test/java/tech/jhipster/lite/generator/project/domain/ProjectTest.java index 3cd88ac4968..d7cfeb7a6d3 100644 --- a/src/test/java/tech/jhipster/lite/generator/project/domain/ProjectTest.java +++ b/src/test/java/tech/jhipster/lite/generator/project/domain/ProjectTest.java @@ -22,7 +22,7 @@ class ProjectTest { @Nested - class Build { + class BuildTest { @Test void shouldBuildMinimalProject() { @@ -87,7 +87,7 @@ void shouldNotBuildWithBlankPath() { } @Nested - class GetConfig { + class GetConfigTest { @Test void shouldGetConfig() { @@ -103,7 +103,7 @@ void shouldGetConfig() { } @Nested - class AddConfig { + class AddConfigTest { @Test void shouldAddConfigInEmptyConfig() { @@ -178,7 +178,7 @@ void shouldNotAddDefaultConfig() { } @Nested - class PackageName { + class PackageNameTest { @Test void shouldGetPackageName() { @@ -214,7 +214,7 @@ void shouldNotGetPackageNamePathForDefault() { } @Nested - class GetStringConfig { + class GetStringConfigTest { @Test void shouldGetStringConfig() { @@ -245,7 +245,7 @@ void shouldNotGetStringConfig() { } @Nested - class GetIntegerConfig { + class GetIntegerConfigTest { @Test void shouldGetIntegerConfig() { diff --git a/src/test/java/tech/jhipster/lite/generator/server/springboot/properties/application/SpringBootPropertiesApplicationServiceIT.java b/src/test/java/tech/jhipster/lite/generator/server/springboot/properties/application/SpringBootPropertiesApplicationServiceIT.java index 43840f8064c..acc77c095f3 100644 --- a/src/test/java/tech/jhipster/lite/generator/server/springboot/properties/application/SpringBootPropertiesApplicationServiceIT.java +++ b/src/test/java/tech/jhipster/lite/generator/server/springboot/properties/application/SpringBootPropertiesApplicationServiceIT.java @@ -20,7 +20,7 @@ class SpringBootPropertiesApplicationServiceIT { SpringBootPropertiesApplicationService service; @Nested - class Properties { + class PropertiesIT { @Test void shouldNotAddProperties() { @@ -72,7 +72,7 @@ void shouldNotAddPropertiesWhenNoApplicationProperties() { } @Nested - class FastProperties { + class FastPropertiesIT { @Test void shouldNotAddPropertiesFast() { @@ -125,7 +125,7 @@ void shouldNotAddPropertiesFastWhenNoApplicationProperties() { } @Nested - class TestProperties { + class TestPropertiesIT { @Test void shouldNotAddPropertiesTest() {