BAEL-4785 | Refactor | assert the beans with the class instead of bean name

This commit is contained in:
vishal 2021-04-10 16:04:51 +02:00
parent b85fde323c
commit 8c2db90f7f
1 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,7 @@
package com.baeldung.springbean.naming; package com.baeldung.springbean.naming;
import com.baeldung.springbean.naming.component.Cat;
import com.baeldung.springbean.naming.component.Dog;
import com.baeldung.springbean.naming.service.PetShow; import com.baeldung.springbean.naming.service.PetShow;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -64,7 +66,7 @@ public class SpringBeanNamingTest {
assertNotNull(context.getBean("cat")); assertNotNull(context.getBean("cat"));
assertNotNull(context.getBean("dog")); assertNotNull(context.getBean("dog"));
assertThat(petShow.getCat().name()).isEqualTo("Cat"); assertThat(petShow.getCat().getClass()).isEqualTo(Cat.class);
assertThat(petShow.getDog().name()).isEqualTo("Dog"); assertThat(petShow.getDog().getClass()).isEqualTo(Dog.class);
} }
} }