Skip to content

Commit

Permalink
fix issue assertj#122
Browse files Browse the repository at this point in the history
  • Loading branch information
Барабанов Тимофей Андреевич committed Aug 29, 2023
1 parent 159bafd commit f1f348b
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,19 @@ private String generateAssertionEntryPointMethodsFor(final Set<ClassDescription>
// resolve class (ex: Player)
// in case of inner classes like Movie.PublicCategory use class name with outer class i.e. Movie.PublicCategory.
assertionEntryPointMethodContent = replace(assertionEntryPointMethodContent, CLASS_TO_ASSERT,
classDescription.getFullyQualifiedClassName());
getAssertClassName(classDescription));

allAssertThatsContentBuilder.append(lineSeparator).append(assertionEntryPointMethodContent);
}
return allAssertThatsContentBuilder.toString();
}

private String getAssertClassName(final ClassDescription classDescription) {
return generatedAssertionsPackage == null ?
classDescription.getFullyQualifiedAssertClassName() :
generatedAssertionsPackage + "." + classDescription.getAssertClassName();
}

private String determineBestEntryPointsAssertionsClassPackage(final Set<ClassDescription> classDescriptionSet) {
if (generatedAssertionsPackage != null) {
return generatedAssertionsPackage;
Expand All @@ -497,7 +503,7 @@ private String determineBestEntryPointsAssertionsClassPackage(final Set<ClassDes
/**
* Returns the target directory path where the assertions file for given classDescription will be created.
*
* @param packageName package name
* @param packageName package name
* @return the target directory path corresponding to the given package.
*/
private String getDirectoryPathCorrespondingToPackage(final String packageName) {
Expand Down Expand Up @@ -607,11 +613,12 @@ private String assertionContentForField(FieldDescription field, ClassDescription

private String getTypeName(DataDescription fieldOrGetter) {
if (generatedAssertionsPackage != null) {
// if the user has chosen to generate assertions in a given package we assume that
// if the user has chosen to generate assertions in a given package we assume that
return fieldOrGetter.getFullyQualifiedTypeName();
}
// 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
// Assert class is generated.
// 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
// Assert class is generated.
return fieldOrGetter.getTypeName();
}

Expand Down

0 comments on commit f1f348b

Please sign in to comment.