Skip to content

Commit f1f348b

Browse files
author
Барабанов Тимофей Андреевич
committed
fix issue #122
1 parent 159bafd commit f1f348b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/main/java/org/assertj/assertions/generator/BaseAssertionGenerator.java

+12-5
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,19 @@ private String generateAssertionEntryPointMethodsFor(final Set<ClassDescription>
473473
// resolve class (ex: Player)
474474
// in case of inner classes like Movie.PublicCategory use class name with outer class i.e. Movie.PublicCategory.
475475
assertionEntryPointMethodContent = replace(assertionEntryPointMethodContent, CLASS_TO_ASSERT,
476-
classDescription.getFullyQualifiedClassName());
476+
getAssertClassName(classDescription));
477477

478478
allAssertThatsContentBuilder.append(lineSeparator).append(assertionEntryPointMethodContent);
479479
}
480480
return allAssertThatsContentBuilder.toString();
481481
}
482482

483+
private String getAssertClassName(final ClassDescription classDescription) {
484+
return generatedAssertionsPackage == null ?
485+
classDescription.getFullyQualifiedAssertClassName() :
486+
generatedAssertionsPackage + "." + classDescription.getAssertClassName();
487+
}
488+
483489
private String determineBestEntryPointsAssertionsClassPackage(final Set<ClassDescription> classDescriptionSet) {
484490
if (generatedAssertionsPackage != null) {
485491
return generatedAssertionsPackage;
@@ -497,7 +503,7 @@ private String determineBestEntryPointsAssertionsClassPackage(final Set<ClassDes
497503
/**
498504
* Returns the target directory path where the assertions file for given classDescription will be created.
499505
*
500-
* @param packageName package name
506+
* @param packageName package name
501507
* @return the target directory path corresponding to the given package.
502508
*/
503509
private String getDirectoryPathCorrespondingToPackage(final String packageName) {
@@ -607,11 +613,12 @@ private String assertionContentForField(FieldDescription field, ClassDescription
607613

608614
private String getTypeName(DataDescription fieldOrGetter) {
609615
if (generatedAssertionsPackage != null) {
610-
// if the user has chosen to generate assertions in a given package we assume that
616+
// if the user has chosen to generate assertions in a given package we assume that
611617
return fieldOrGetter.getFullyQualifiedTypeName();
612618
}
613-
// returns a simple class name if the field or getter type is in the same package as its owning type which is the package where the
614-
// Assert class is generated.
619+
// returns a simple class name if the field or getter type is in the same package as its owning type which is the package
620+
// where the
621+
// Assert class is generated.
615622
return fieldOrGetter.getTypeName();
616623
}
617624

0 commit comments

Comments
 (0)