How to use failShouldBeEquivalentToAsPropertiesAreDifferent method of org.amshove.kluent.tests.equivalency.ShouldBeEquivalentTo class

Best Kluent code snippet using org.amshove.kluent.tests.equivalency.ShouldBeEquivalentTo.failShouldBeEquivalentToAsPropertiesAreDifferent

ShouldBeEquivalentTo.kt

Source:ShouldBeEquivalentTo.kt Github

copy

Full Screen

...9import java.time.LocalDate10@ExperimentalStdlibApi11class ShouldBeEquivalentTo {12 @Test13 fun failShouldBeEquivalentToAsPropertiesAreDifferent() {14 // arrange15 val team1 = Team("team1").apply {16 persons = listOf(17 Person("John", "Johnson").apply {18 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")19 },20 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }21 )22 }23 val team2 = Team("team1").apply {24 persons = listOf(25 )26 }27 // assert28 assertFailsWith(ComparisonFailedException::class) {29 team1.shouldBeEquivalentTo(team2)30 }31 }32 @Test33 fun passShouldNotBeEquivalentToAsPropertiesAreDifferent() {34 // arrange35 val team1 = Team("team1").apply {36 persons = listOf(37 Person("John", "Johnson").apply {38 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")39 },40 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }41 )42 }43 val team2 = Team("team1").apply {44 persons = listOf(45 Person("John", "Johnson"),46 Person("Marc", "Marcson")47 )48 }49 // assert50 team1.shouldNotBeEquivalentTo(team2) { it.compareByProperties() }51 }52 @Test53 fun failShouldBeEquivalentToAsPropertiesAreDifferentForIterables() {54 // arrange55 val teams1 = listOf(56 Team("team1").apply {57 persons = listOf(58 Person("John", "Johnson").apply {59 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")60 },61 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }62 )63 },64 Team("team2").apply {65 persons = listOf(66 Person("John", "Johnson"),67 Person("Marc", "Marcson")68 )69 },70 Team("team3").apply {71 persons = listOf(72 Person("John", "Johnson").apply {73 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")74 },75 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }76 )77 }78 )79 val teams2 = listOf(80 Team("team1").apply {81 persons = listOf(82 Person("John", "Johnson").apply {83 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")84 },85 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }86 )87 },88 Team("team2").apply {89 persons = listOf(90 Person("John", "Johnson"),91 Person("Marc", "")92 )93 },94 Team("team3").apply {95 persons = listOf(96 Person("John", "Johnson").apply {97 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")98 },99 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }100 )101 }102 )103 // assert104 assertFailsWith(ComparisonFailedException::class) {105 teams1.shouldBeEquivalentTo(teams2) {106 it.compareByProperties()107 }108 }109 }110 @Test111 fun passShouldNotBeEquivalentToAsPropertiesAreDifferentForIterables() {112 // arrange113 val teams1 = listOf(114 Team("team1").apply {115 persons = listOf(116 Person("John", "Johnson").apply {117 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")118 },119 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }120 )121 },122 Team("team2").apply {123 persons = listOf(124 Person("John", "Johnson"),125 Person("Marc", "Marcson")126 )127 },128 Team("team2").apply {129 persons = listOf(130 Person("John", "Johnson"),131 Person("Marc", "Marcson")132 )133 }134 )135 val teams2 = listOf(136 Team("team2").apply {137 persons = listOf(138 Person("John", "Johnson"),139 Person("Marc", "")140 )141 },142 Team("team1").apply {143 persons = listOf(144 Person("John", "Johnson").apply {145 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")146 },147 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }148 )149 },150 Team("team2").apply {151 persons = listOf(152 Person("John", "Johnson"),153 Person("Marc", "Marcson")154 )155 }156 )157 // assert158 teams1.shouldNotBeEquivalentTo(teams2)159 }160 @Test161 fun passShouldBeEquivalentToWithStrictOrderingAsPropertiesAreEqualForIterables() {162 // arrange163 val teams1 = listOf(164 Team("team1").apply {165 persons = listOf(166 Person("John", "Johnson").apply {167 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")168 },169 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }170 )171 },172 Team("team2").apply {173 persons = listOf(174 Person("John", "Johnson"),175 Person("Marc", "")176 )177 },178 Team("team3").apply {179 persons = listOf(180 Person("John", "Johnson"),181 Person("Marc", "Marcson")182 )183 }184 )185 val teams2 = listOf(186 Team("team1").apply {187 persons = listOf(188 Person("John", "Johnson").apply {189 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")190 },191 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }192 )193 },194 Team("team2").apply {195 persons = listOf(196 Person("John", "Johnson"),197 Person("Marc", "")198 )199 },200 Team("team3").apply {201 persons = listOf(202 Person("John", "Johnson"),203 Person("Marc", "Marcson")204 )205 }206 )207 // assert208 teams1.shouldBeEquivalentTo(teams2) {209 it.withStrictOrdering()210 }211 }212 @Test213 fun passShouldNotBeEquivalentToWithStrictOrderingEvenIfPropertiesAreEqualForIterables() {214 // arrange215 val teams1 = listOf(216 Team("team1").apply {217 persons = listOf(218 Person("John", "Johnson").apply {219 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")220 },221 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }222 )223 },224 Team("team2").apply {225 persons = listOf(226 Person("John", "Johnson"),227 Person("Marc", "")228 )229 },230 Team("team3").apply {231 persons = listOf(232 Person("John", "Johnson"),233 Person("Marc", "Marcson")234 )235 }236 )237 val teams2 = listOf(238 Team("team1").apply {239 persons = listOf(240 Person("John", "Johnson").apply {241 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")242 },243 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }244 )245 },246 Team("team3").apply {247 persons = listOf(248 Person("John", "Johnson"),249 Person("Marc", "Marcson")250 )251 },252 Team("team2").apply {253 persons = listOf(254 Person("John", "Johnson"),255 Person("Marc", "")256 )257 }258 )259 // assert260 teams1.shouldNotBeEquivalentTo(teams2) {261 it.withStrictOrdering()262 }263 }264 @Test265 fun passShouldBeEquivalentToAsPropertiesAreEqualComparingByProperties() {266 // arrange267 val team1 = Team("team1").apply {268 persons = listOf(269 Person("John", "Johnson").apply {270 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")271 },272 Person("Marc", "Marcson").apply {273 birthDate = LocalDate.of(2020, 2, 1)274 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {275 address2 = "Islington"276 }277 }278 )279 }280 val team2 = Team("team1").apply {281 persons = listOf(282 Person("John", "Johnson").apply {283 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")284 },285 Person("Marc", "Marcson").apply {286 birthDate = LocalDate.of(2020, 2, 1)287 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {288 address2 = "Islington"289 }290 }291 )292 }293 // assert294 team1.shouldBeEquivalentTo(team2) { it.compareByProperties() }295 }296 @Test297 fun failShouldNotBeEquivalentToAsPropertiesAreEqualComparingByProperties() {298 // arrange299 val team1 = Team("team1").apply {300 persons = listOf(301 Person("John", "Johnson").apply {302 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")303 },304 Person("Marc", "Marcson").apply {305 birthDate = LocalDate.of(2020, 2, 1)306 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {307 address2 = "Islington"308 }309 }310 )311 }312 val team2 = Team("team1").apply {313 persons = listOf(314 Person("John", "Johnson").apply {315 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")316 },317 Person("Marc", "Marcson").apply {318 birthDate = LocalDate.of(2020, 2, 1)319 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {320 address2 = "Islington"321 }322 }323 )324 }325 // assert326 assertFailsWith(ComparisonFailedException::class) {327 team1.shouldNotBeEquivalentTo(team2) { it.compareByProperties() }328 }329 }330 @Test331 fun failShouldBeEquivalentToAsIncludedPropertyPersonsIsDifferent() {332 // arrange333 val team1 = Team("team1").apply {334 persons = listOf(335 Person("John", "Johnson").apply {336 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")337 },338 Person("Marc", "Marcson").apply {339 birthDate = LocalDate.of(2020, 2, 1)340 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {341 address2 = "Islington"342 }343 }344 )345 }346 val team2 = Team("team1").apply {347 persons = listOf(348 Person("John", "Johnson").apply {349 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")350 },351 Person("Marc", "Marcson").apply {352 birthDate = LocalDate.of(2020, 2, 1)353 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK")354 }355 )356 }357 // assert358 assertFailsWith(ComparisonFailedException::class) {359 team1.shouldBeEquivalentTo(team2) {360 it.including(Team::persons)361 }362 }363 }364 @Test365 fun passShouldNotBeEquivalentToAsIncludedPropertyPersonsIsDifferent() {366 // arrange367 val team1 = Team("team1").apply {368 persons = listOf(369 Person("John", "Johnson").apply {370 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")371 },372 Person("Marc", "Marcson").apply {373 birthDate = LocalDate.of(2020, 2, 1)374 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {375 address2 = "Islington"376 }377 }378 )379 }380 val team2 = Team("team1").apply {381 persons = listOf(382 Person("John", "Johnson").apply {383 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")384 },385 Person("Marc", "Marcson").apply {386 birthDate = LocalDate.of(2020, 2, 1)387 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK")388 }389 )390 }391 // assert392 team1.shouldNotBeEquivalentTo(team2) {393 it.including(Team::persons)394 }395 }396 @Test397 fun passShouldBeEquivalentToEvenIfExcludedPropertyPersonsIsDifferent() {398 // arrange399 val team1 = Team("team1").apply {400 persons = listOf(401 Person("John", "Johnson").apply {402 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")403 },404 Person("Marc", "Marcson").apply {405 birthDate = LocalDate.of(2020, 2, 1)406 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {407 address2 = "Islington"408 }409 }410 )411 }412 val team2 = Team("team1").apply {413 persons = listOf(414 Person("John", "Johnson").apply {415 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")416 },417 Person("Marc", "Marcson").apply {418 birthDate = LocalDate.of(2020, 2, 1)419 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK")420 }421 )422 }423 // assert424 team1.shouldBeEquivalentTo(team2) {425 it.excluding(Team::persons)426 }427 }428 @Test429 fun failShouldNotBeEquivalentToEvenIfExcludedPropertyPersonsIsDifferent() {430 // arrange431 val team1 = Team("team1").apply {432 persons = listOf(433 Person("John", "Johnson").apply {434 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")435 },436 Person("Marc", "Marcson").apply {437 birthDate = LocalDate.of(2020, 2, 1)438 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {439 address2 = "Islington"440 }441 }442 )443 }444 val team2 = Team("team1").apply {445 persons = listOf(446 Person("John", "Johnson").apply {447 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")448 },449 Person("Marc", "Marcson").apply {450 birthDate = LocalDate.of(2020, 2, 1)451 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK")452 }453 )454 }455 // assert456 assertFailsWith(ComparisonFailedException::class) {457 team1.shouldNotBeEquivalentTo(team2) {458 it.excluding(Team::persons)459 }460 }461 }462 @Test463 fun failShouldBeEquivalentToEvenIfExcludedPropertyPersonsIsEqual() {464 // arrange465 val team1 = Team("team1").apply {466 persons = listOf(467 Person("John", "Johnson").apply {468 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")469 },470 Person("Marc", "Marcson").apply {471 birthDate = LocalDate.of(2020, 2, 1)472 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {473 address2 = "Islington"474 }475 }476 )477 }478 val team2 = Team("team2").apply {479 persons = listOf(480 Person("John", "Johnson").apply {481 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")482 },483 Person("Marc", "Marcson").apply {484 birthDate = LocalDate.of(2020, 2, 1)485 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK")486 }487 )488 }489 // assert490 assertFailsWith(ComparisonFailedException::class) {491 team1.shouldBeEquivalentTo(team2) {492 it.excluding(Team::persons)493 }494 }495 }496 @Test497 fun passShouldNotBeEquivalentToEvenIfExcludedPropertyPersonsIsEqual() {498 // arrange499 val team1 = Team("team1").apply {500 persons = listOf(501 Person("John", "Johnson").apply {502 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")503 },504 Person("Marc", "Marcson").apply {505 birthDate = LocalDate.of(2020, 2, 1)506 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {507 address2 = "Islington"508 }509 }510 )511 }512 val team2 = Team("team2").apply {513 persons = listOf(514 Person("John", "Johnson").apply {515 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")516 },517 Person("Marc", "Marcson").apply {518 birthDate = LocalDate.of(2020, 2, 1)519 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK")520 }521 )522 }523 // assert524 team1.shouldNotBeEquivalentTo(team2) {525 it.excluding(Team::persons)526 }527 }528 @Test529 fun failShouldBeEquivalentToAsIncludedPropertyNameIsDifferent() {530 // arrange531 val team1 = Team("team1").apply {532 persons = listOf(533 Person("John", "Johnson").apply {534 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")535 },536 Person("Marc", "Marcson").apply {537 birthDate = LocalDate.of(2020, 2, 1)538 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {539 address2 = "Islington"540 }541 }542 )543 }544 val team2 = Team("team2").apply {545 persons = listOf(546 Person("John", "Watson"),547 Person("Marco", "Polo")548 )549 }550 // assert551 assertFailsWith(ComparisonFailedException::class) {552 team1.shouldBeEquivalentTo(team2) {553 it.including(Team::name)554 }555 }556 }557 @Test558 fun passShouldNotBeEquivalentToAsIncludedPropertyNameIsDifferent() {559 // arrange560 val team1 = Team("team1").apply {561 persons = listOf(562 Person("John", "Johnson").apply {563 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")564 },565 Person("Marc", "Marcson").apply {566 birthDate = LocalDate.of(2020, 2, 1)567 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {568 address2 = "Islington"569 }570 }571 )572 }573 val team2 = Team("team2").apply {574 persons = listOf(575 Person("John", "Watson"),576 Person("Marco", "Polo")577 )578 }579 // assert580 team1.shouldNotBeEquivalentTo(team2) {581 it.including(Team::name)582 }583 }584 @Test585 fun passShouldBeEquivalentToAsIncludedPropertiesAreEqual() {586 // arrange587 val team1 = Team("team1").apply {588 persons = listOf(589 Person("John", "Johnson"),590 Person("Marc", "Marcson").apply {591 birthDate = LocalDate.of(2020, 2, 1)592 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {593 address2 = "Islington"594 }595 }596 )597 }598 val team2 = Team("team2").apply {599 persons = listOf(600 Person("John", "Johnson"),601 Person("Marc", "Marcson").apply {602 birthDate = LocalDate.of(2020, 2, 1)603 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {604 address2 = "Islington"605 }606 }607 )608 }609 // assert610 team1.shouldBeEquivalentTo(team2) {611 it.including(Team::persons)612 }613 }614 @Test615 fun failShouldNotBeEquivalentToAsIncludedPropertiesAreEqual() {616 // arrange617 val team1 = Team("team1").apply {618 persons = listOf(619 Person("John", "Johnson"),620 Person("Marc", "Marcson").apply {621 birthDate = LocalDate.of(2020, 2, 1)622 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {623 address2 = "Islington"624 }625 }626 )627 }628 val team2 = Team("team2").apply {629 persons = listOf(630 Person("John", "Johnson"),631 Person("Marc", "Marcson").apply {632 birthDate = LocalDate.of(2020, 2, 1)633 address = Address("Graham Street", "36", "London", "N1 8GJ", "UK").apply {634 address2 = "Islington"635 }636 }637 )638 }639 // assert640 assertFailsWith(ComparisonFailedException::class) {641 team1.shouldNotBeEquivalentTo(team2) {642 it.including(Team::persons)643 }644 }645 }646 @Test647 fun passShouldBeEquivalentToEvenIfPropertiesAreDifferentAsExcludingNestedObjects() {648 // arrange649 val team1 = Team("team1").apply {650 persons = listOf(651 Person("John", "Johnson").apply {652 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")653 },654 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }655 )656 }657 val team2 = Team("team1").apply {658 persons = listOf(659 Person("John", "Johnson"),660 Person("Marc", "Marcson")661 )662 }663 // assert664 team1.shouldBeEquivalentTo(team2) {665 it.excludingNestedObjects()666 }667 }668 @Test669 fun failShouldNotBeEquivalentToEvenIfPropertiesAreDifferentAsExcludingNestedObjects() {670 // arrange671 val team1 = Team("team1").apply {672 persons = listOf(673 Person("John", "Johnson").apply {674 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")675 },676 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }677 )678 }679 val team2 = Team("team1").apply {680 persons = listOf(681 Person("John", "Johnson"),682 Person("Marc", "Marcson")683 )684 }685 // assert686 assertFailsWith(ComparisonFailedException::class) {687 team1.shouldNotBeEquivalentTo(team2) {688 it.excludingNestedObjects()689 }690 }691 }692 @Test693 fun failShouldBeEquivalentToEvenIfPropertiesAreEqualAsExcludingNestedObjects() {694 // arrange695 val team1 = Team("team1").apply {696 persons = listOf(697 Person("John", "Johnson").apply {698 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")699 },700 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }701 )702 }703 val team2 = Team("team2").apply {704 persons = listOf(705 Person("John", "Johnson").apply {706 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")707 },708 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }709 )710 }711 // assert712 assertFailsWith(ComparisonFailedException::class) {713 team1.shouldBeEquivalentTo(team2) {714 it.excludingNestedObjects()715 }716 }717 }718 @Test719 fun passShouldNotBeEquivalentToEvenIfPropertiesAreEqualAsExcludingNestedObjects() {720 // arrange721 val team1 = Team("team1").apply {722 persons = listOf(723 Person("John", "Johnson").apply {724 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")725 },726 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }727 )728 }729 val team2 = Team("team2").apply {730 persons = listOf(731 Person("John", "Johnson").apply {732 address = Address("Mainzerlandstrasse", "200", "Frankfurt am Main", "60327", "Germany")733 },734 Person("Marc", "Marcson").apply { birthDate = LocalDate.of(2020, 2, 1) }735 )736 }737 // assert738 team1.shouldNotBeEquivalentTo(team2) {739 it.excludingNestedObjects()740 }741 }742 @Test743 fun passShouldBeEquivalentToEvenIfPropertiesAreDifferentAsNotAllowingInfiniteRecursion() {744 // arrange745 val a1 = A("name1").apply {746 b = B("name11").apply {747 c = C(D("name111").apply { name2 = "name1111" })748 }749 }750 val a2 = A("name1").apply {751 b = B("name11").apply {752 c = C(D("name311").apply { name2 = "name3111" })753 }754 }755 // assert756 a1.shouldBeEquivalentTo(a2) {757 it.maxLevelOfRecursion = 3758 return@shouldBeEquivalentTo it759 }760 }761 @Test762 fun failShouldNotBeEquivalentToEvenIfPropertiesAreDifferentAsNotAllowingInfiniteRecursion() {763 // arrange764 val a1 = A("name1").apply {765 b = B("name11").apply {766 c = C(D("name111").apply { name2 = "name1111" })767 }768 }769 val a2 = A("name1").apply {770 b = B("name11").apply {771 c = C(D("name311").apply { name2 = "name3111" })772 }773 }774 // assert775 assertFailsWith(ComparisonFailedException::class) {776 a1.shouldNotBeEquivalentTo(a2) {777 it.maxLevelOfRecursion = 3778 return@shouldNotBeEquivalentTo it779 }780 }781 }782 @Test783 fun passShouldNotBeEquivalentToAsPropertiesAreDifferentAndAllowingInfiniteRecursion() {784 // arrange785 val a1 = listOf(786 A("name1").apply {787 b = B("name11").apply {788 c = C(D("name111").apply { name2 = "name1111" }).apply { name = "name1111" }789 d = D("name111").apply {790 Elist = mutableListOf(791 E().apply {792 Flist = listOf(793 F(1),794 F(2)795 )796 },797 E().apply {798 Flist = listOf(799 F(3),800 F(4)801 )802 }803 )804 name2 = "name1111"805 }806 }807 e = "abc"808 },809 A("name2").apply {810 b = B("name11").apply {811 c = C(D("name111").apply { name2 = "name2111" }).apply { name = "name1111" }812 d = D("name111").apply { name2 = "name1111" }813 }814 e = "abc"815 }816 )817 val a2 = listOf(818 A("name1").apply {819 b = B("name11").apply {820 c = C(D("name111").apply { name2 = "name1111" }).apply { name = "name1111" }821 d = D("name111").apply { name2 = "name1111" }822 }823 e = "abc"824 },825 A("name2").apply {826 b = B("name11").apply {827 c = C(D("name111").apply { name2 = "name3111" }).apply { name = "name1111" }828 d = D("name111").apply { name2 = "name1111" }829 }830 e = "abc"831 }832 )833 // assert834 a1.shouldNotBeEquivalentTo(a2) {835 // set the default maxLevelOfRecursion = 2 but allow infinite recursion836 it.maxLevelOfRecursion = 2837 it.allowingInfiniteRecursion()838 return@shouldNotBeEquivalentTo it839 }840 }841 @Test842 fun failShouldBeEquivalentToAsPropertiesAreDifferentAndAllowingInfiniteRecursion() {843 // arrange844 val a1 = listOf(845 A("name1").apply {846 b = B("name11").apply {847 c = C(D("name111").apply { name2 = "name1111" }).apply { name = "name1111" }848 d = D("name111").apply {849 Elist = mutableListOf(850 E().apply {851 Flist = listOf(852 F(1),853 F(2)854 )855 },856 E().apply {...

Full Screen

Full Screen

failShouldBeEquivalentToAsPropertiesAreDifferent

Using AI Code Generation

copy

Full Screen

1failShouldBeEquivalentToAsPropertiesAreDifferent()2failShouldBeEquivalentToAsPropertiesAreDifferentWithCustomMessage()3failShouldBeEquivalentToAsPropertiesAreDifferentWithCustomMessageUsingAnInterpolatedString()4failShouldBeEquivalentToAsPropertiesAreDifferentWithCustomMessageUsingAnInterpolatedStringWithDifferentValues()5failShouldBeEquivalentToAsPropertiesAreDifferentWithCustomMessageUsingAnInterpolatedStringWithDifferentValuesAndInterpolatedValues()6failShouldBeEquivalentToAsPropertiesAreDifferentWithCustomMessageUsingAnInterpolatedStringWithDifferentValuesAndInterpolatedValuesAndDifferentTypes()7failShouldBeEquivalentToAsPropertiesAreDifferentWithCustomMessageUsingAnInterpolatedStringWithDifferentValuesAndInterpolatedValuesAndDifferentTypesAndDifferentValues()

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kluent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in ShouldBeEquivalentTo

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful