@@ -463,7 +463,7 @@ public void twoGetters_interface() throws CannotGenerateCodeException {
463
463
}
464
464
465
465
@ Test
466
- public void ignoredEqualsAndHashCode () throws CannotGenerateCodeException {
466
+ public void ignoredByEquals () throws CannotGenerateCodeException {
467
467
GeneratedBuilder builder = (GeneratedBuilder ) analyser .analyse (model .newType (
468
468
"package com.example;" ,
469
469
"public class DataType {" ,
@@ -485,7 +485,33 @@ public void ignoredEqualsAndHashCode() throws CannotGenerateCodeException {
485
485
}
486
486
487
487
@ Test
488
- public void ignoredToString () throws CannotGenerateCodeException {
488
+ public void ignoredByEquals_notInherited () throws CannotGenerateCodeException {
489
+ model .newType (
490
+ "package com.example;" ,
491
+ "public interface HasName {" ,
492
+ " @" + IgnoredByEquals .class .getName () + " public abstract String getName();" ,
493
+ "}" );
494
+ GeneratedBuilder builder = (GeneratedBuilder ) analyser .analyse (model .newType (
495
+ "package com.example;" ,
496
+ "public class DataType implements HasName {" ,
497
+ " public static class Builder extends DataType_Builder {}" ,
498
+ "}" ));
499
+
500
+ Property name = new Property .Builder ()
501
+ .setAllCapsName ("NAME" )
502
+ .setCapitalizedName ("Name" )
503
+ .setFullyCheckedCast (true )
504
+ .setGetterName ("getName" )
505
+ .setName ("name" )
506
+ .setType (model .typeMirror (String .class ))
507
+ .setUsingBeanConvention (true )
508
+ .setInEqualsAndHashCode (true )
509
+ .build ();
510
+ assertThat (builder .getGeneratorsByProperty ().keySet ()).containsExactly (name );
511
+ }
512
+
513
+ @ Test
514
+ public void notInToString () throws CannotGenerateCodeException {
489
515
GeneratedBuilder builder = (GeneratedBuilder ) analyser .analyse (model .newType (
490
516
"package com.example;" ,
491
517
"public class DataType {" ,
@@ -506,6 +532,32 @@ public void ignoredToString() throws CannotGenerateCodeException {
506
532
assertThat (builder .getGeneratorsByProperty ().keySet ()).containsExactly (name );
507
533
}
508
534
535
+ @ Test
536
+ public void notInToString_notInherited () throws CannotGenerateCodeException {
537
+ model .newType (
538
+ "package com.example;" ,
539
+ "public interface HasName {" ,
540
+ " @" + NotInToString .class .getName () + " public abstract String getName();" ,
541
+ "}" );
542
+ GeneratedBuilder builder = (GeneratedBuilder ) analyser .analyse (model .newType (
543
+ "package com.example;" ,
544
+ "public class DataType implements HasName {" ,
545
+ " public static class Builder extends DataType_Builder {}" ,
546
+ "}" ));
547
+
548
+ Property name = new Property .Builder ()
549
+ .setAllCapsName ("NAME" )
550
+ .setCapitalizedName ("Name" )
551
+ .setFullyCheckedCast (true )
552
+ .setGetterName ("getName" )
553
+ .setName ("name" )
554
+ .setType (model .typeMirror (String .class ))
555
+ .setUsingBeanConvention (true )
556
+ .setInToString (true )
557
+ .build ();
558
+ assertThat (builder .getGeneratorsByProperty ().keySet ()).containsExactly (name );
559
+ }
560
+
509
561
@ Test
510
562
public void ignoredEqualsAndHashCodeAndToString () throws CannotGenerateCodeException {
511
563
GeneratedBuilder builder = (GeneratedBuilder ) analyser .analyse (model .newType (
0 commit comments