@@ -473,13 +473,19 @@ private String generateAssertionEntryPointMethodsFor(final Set<ClassDescription>
473
473
// resolve class (ex: Player)
474
474
// in case of inner classes like Movie.PublicCategory use class name with outer class i.e. Movie.PublicCategory.
475
475
assertionEntryPointMethodContent = replace (assertionEntryPointMethodContent , CLASS_TO_ASSERT ,
476
- classDescription . getFullyQualifiedClassName ( ));
476
+ getAssertClassName ( classDescription ));
477
477
478
478
allAssertThatsContentBuilder .append (lineSeparator ).append (assertionEntryPointMethodContent );
479
479
}
480
480
return allAssertThatsContentBuilder .toString ();
481
481
}
482
482
483
+ private String getAssertClassName (final ClassDescription classDescription ) {
484
+ return generatedAssertionsPackage == null ?
485
+ classDescription .getFullyQualifiedAssertClassName () :
486
+ generatedAssertionsPackage + "." + classDescription .getAssertClassName ();
487
+ }
488
+
483
489
private String determineBestEntryPointsAssertionsClassPackage (final Set <ClassDescription > classDescriptionSet ) {
484
490
if (generatedAssertionsPackage != null ) {
485
491
return generatedAssertionsPackage ;
@@ -497,7 +503,7 @@ private String determineBestEntryPointsAssertionsClassPackage(final Set<ClassDes
497
503
/**
498
504
* Returns the target directory path where the assertions file for given classDescription will be created.
499
505
*
500
- * @param packageName package name
506
+ * @param packageName package name
501
507
* @return the target directory path corresponding to the given package.
502
508
*/
503
509
private String getDirectoryPathCorrespondingToPackage (final String packageName ) {
@@ -607,11 +613,12 @@ private String assertionContentForField(FieldDescription field, ClassDescription
607
613
608
614
private String getTypeName (DataDescription fieldOrGetter ) {
609
615
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
611
617
return fieldOrGetter .getFullyQualifiedTypeName ();
612
618
}
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.
615
622
return fieldOrGetter .getTypeName ();
616
623
}
617
624
0 commit comments