org.springframework.test.context.junit.jupiter.comics.Person Java Examples

The following examples show how to use org.springframework.test.context.junit.jupiter.comics.Person. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RegisterExtensionSpringExtensionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * NOTE: Test code must be compiled with "-g" (debug symbols) or "-parameters" in
 * order for the parameter name to be used as the qualifier; otherwise, use
 * {@code @Qualifier("wally")}.
 */
@Test
void autowiredParameterWithImplicitQualifierBasedOnParameterName(
		@Autowired Person wally) {
	assertNotNull(wally, "Wally should have been @Autowired by Spring");
	assertEquals("Wally", wally.getName(), "Person's name");
}
 
Example #2
Source File: RegisterExtensionSpringExtensionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
void genericApplicationContextInjectedIntoMethod(
		GenericApplicationContext applicationContext) {
	assertNotNull(applicationContext,
			"GenericApplicationContext should have been injected by Spring");
	assertEquals(this.dilbert, applicationContext.getBean("dilbert", Person.class));
}
 
Example #3
Source File: RegisterExtensionSpringExtensionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * NOTE: Test code must be compiled with "-g" (debug symbols) or "-parameters" in
 * order for the parameter name to be used as the qualifier; otherwise, use
 * {@code @Qualifier("wally")}.
 */
@Test
void autowiredParameterWithImplicitQualifierBasedOnParameterName(
		@Autowired Person wally) {
	assertNotNull(wally, "Wally should have been @Autowired by Spring");
	assertEquals("Wally", wally.getName(), "Person's name");
}
 
Example #4
Source File: SpringJUnitJupiterAutowiredConstructorInjectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Autowired
SpringJUnitJupiterAutowiredConstructorInjectionTests(ApplicationContext applicationContext, Person dilbert, Dog dog,
		@Value("${enigma}") Integer enigma) {

	this.applicationContext = applicationContext;
	this.dilbert = dilbert;
	this.dog = dog;
	this.enigma = enigma;
}
 
Example #5
Source File: PersonController.java    From java-technology-stack with MIT License 5 votes vote down vote up
@GetMapping("/person/{id}")
Person getPerson(@PathVariable long id) {
	if (id == 42) {
		return new Person("Dilbert");
	}
	return new Person("Wally");
}
 
Example #6
Source File: SpringJUnitJupiterConstructorInjectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
SpringJUnitJupiterConstructorInjectionTests(ApplicationContext applicationContext, @Autowired Person dilbert,
		@Autowired Dog dog, @Value("${enigma}") Integer enigma, TestInfo testInfo) {

	this.applicationContext = applicationContext;
	this.dilbert = dilbert;
	this.dog = dog;
	this.enigma = enigma;
	this.testInfo = testInfo;
}
 
Example #7
Source File: SpringJUnitJupiterConstructorInjectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
SpringJUnitJupiterConstructorInjectionTests(ApplicationContext applicationContext, @Autowired Person dilbert,
		@Autowired Dog dog, @Value("${enigma}") Integer enigma, TestInfo testInfo) {

	this.applicationContext = applicationContext;
	this.dilbert = dilbert;
	this.dog = dog;
	this.enigma = enigma;
	this.testInfo = testInfo;
}
 
Example #8
Source File: RegisterExtensionSpringExtensionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
void genericApplicationContextInjectedIntoMethod(
		GenericApplicationContext applicationContext) {
	assertNotNull(applicationContext,
			"GenericApplicationContext should have been injected by Spring");
	assertEquals(this.dilbert, applicationContext.getBean("dilbert", Person.class));
}
 
Example #9
Source File: PersonController.java    From spring-test-junit5 with Apache License 2.0 5 votes vote down vote up
@GetMapping("/person/{id}")
Person getPerson(@PathVariable long id) {
	if (id == 42) {
		return new Person("Dilbert");
	}
	return new Person("Wally");
}
 
Example #10
Source File: TestConstructorAnnotationIntegrationTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
TestConstructorAnnotationIntegrationTests(ApplicationContext applicationContext, Person dilbert, Dog dog,
		@Value("${enigma}") Integer enigma) {

	this.applicationContext = applicationContext;
	this.dilbert = dilbert;
	this.dog = dog;
	this.enigma = enigma;
}
 
Example #11
Source File: SpringJUnitJupiterAutowiredConstructorInjectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Autowired
SpringJUnitJupiterAutowiredConstructorInjectionTests(ApplicationContext applicationContext, Person dilbert, Dog dog,
		@Value("${enigma}") Integer enigma) {

	this.applicationContext = applicationContext;
	this.dilbert = dilbert;
	this.dog = dog;
	this.enigma = enigma;
}
 
Example #12
Source File: PersonController.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@GetMapping("/person/{id}")
Person getPerson(@PathVariable long id) {
	if (id == 42) {
		return new Person("Dilbert");
	}
	return new Person("Wally");
}
 
Example #13
Source File: SpringJUnit5ConstructorInjectionTests.java    From spring-test-junit5 with Apache License 2.0 5 votes vote down vote up
SpringJUnit5ConstructorInjectionTests(ApplicationContext applicationContext, @Autowired Person dilbert,
		@Autowired Dog dog, @Value("${enigma}") Integer enigma, TestInfo testInfo) {

	this.applicationContext = applicationContext;
	this.dilbert = dilbert;
	this.dog = dog;
	this.enigma = enigma;
	this.testInfo = testInfo;
}
 
Example #14
Source File: SpringJUnit5AutowiredConstructorInjectionTests.java    From spring-test-junit5 with Apache License 2.0 5 votes vote down vote up
@Autowired
SpringJUnit5AutowiredConstructorInjectionTests(ApplicationContext applicationContext, Person dilbert, Dog dog,
		@Value("${enigma}") Integer enigma) {

	this.applicationContext = applicationContext;
	this.dilbert = dilbert;
	this.dog = dog;
	this.enigma = enigma;
}
 
Example #15
Source File: TestConfig.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean
Person dilbert() {
	return new Person("Dilbert");
}
 
Example #16
Source File: XmlSpringExtensionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Test
void genericApplicationContextInjectedIntoMethod(GenericApplicationContext applicationContext) {
	assertNotNull(applicationContext, "GenericApplicationContext should have been injected by Spring");
	assertEquals(this.dilbert, applicationContext.getBean("dilbert", Person.class));
}
 
Example #17
Source File: RegisterExtensionSpringExtensionTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
void autowiredParameterWithExplicitQualifier(@Qualifier("wally") Person person) {
	assertNotNull(person, "Wally should have been @Autowired by Spring");
	assertEquals("Wally", person.getName(), "Person's name");
}
 
Example #18
Source File: SpringJUnit5AutowiredConstructorInjectionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Test
void applicationContextInjected() {
	assertNotNull(applicationContext, "ApplicationContext should have been injected by Spring");
	assertEquals(this.dilbert, applicationContext.getBean("dilbert", Person.class));
}
 
Example #19
Source File: RegisterExtensionSpringExtensionTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
void autowiredParameterOfList(@Autowired List<Person> peopleParam) {
	assertNotNull(peopleParam,
			"list of people should have been @Autowired by Spring");
	assertEquals(2, peopleParam.size(), "Number of people in context");
}
 
Example #20
Source File: XmlSpringExtensionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Test
void autowiredParameterOfList(@Autowired List<Person> peopleParam) {
	assertNotNull(peopleParam, "list of people should have been @Autowired by Spring");
	assertEquals(2, peopleParam.size(), "Number of people in context");
}
 
Example #21
Source File: SpringJUnitJupiterConstructorInjectionTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
void applicationContextInjected() {
	assertNotNull(applicationContext, "ApplicationContext should have been injected by Spring");
	assertEquals(this.dilbert, applicationContext.getBean("dilbert", Person.class));
}
 
Example #22
Source File: TestConfig.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Bean
Person dilbert() {
	return new Person("Dilbert");
}
 
Example #23
Source File: TestConfig.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Bean
Person wally() {
	return new Person("Wally");
}
 
Example #24
Source File: SpringExtensionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Test
void applicationContextInjectedIntoMethod(ApplicationContext applicationContext) {
	assertNotNull(applicationContext, "ApplicationContext should have been injected by Spring");
	assertEquals(this.dilbert, applicationContext.getBean("dilbert", Person.class));
}
 
Example #25
Source File: SpringExtensionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Test
void genericApplicationContextInjectedIntoMethod(GenericApplicationContext applicationContext) {
	assertNotNull(applicationContext, "GenericApplicationContext should have been injected by Spring");
	assertEquals(this.dilbert, applicationContext.getBean("dilbert", Person.class));
}
 
Example #26
Source File: SpringExtensionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Test
void autowiredParameterWithExplicitQualifier(@Qualifier("wally") Person person) {
	assertNotNull(person, "Wally should have been @Autowired by Spring");
	assertEquals("Wally", person.getName(), "Person's name");
}
 
Example #27
Source File: SpringExtensionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
/**
 * NOTE: Test code must be compiled with "-g" (debug symbols) or "-parameters" in order
 * for the parameter name to be used as the qualifier; otherwise, use
 * {@code @Qualifier("wally")}.
 */
@Test
void autowiredParameterWithImplicitQualifierBasedOnParameterName(@Autowired Person wally) {
	assertNotNull(wally, "Wally should have been @Autowired by Spring");
	assertEquals("Wally", wally.getName(), "Person's name");
}
 
Example #28
Source File: XmlSpringExtensionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
/**
 * NOTE: Test code must be compiled with "-g" (debug symbols) or "-parameters" in order
 * for the parameter name to be used as the qualifier; otherwise, use
 * {@code @Qualifier("wally")}.
 */
@Test
void autowiredParameterWithImplicitQualifierBasedOnParameterName(@Autowired Person wally) {
	assertNotNull(wally, "Wally should have been @Autowired by Spring");
	assertEquals("Wally", wally.getName(), "Person's name");
}
 
Example #29
Source File: SpringExtensionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Test
void autowiredParameterOfList(@Autowired List<Person> peopleParam) {
	assertNotNull(peopleParam, "list of people should have been @Autowired by Spring");
	assertEquals(2, peopleParam.size(), "Number of people in context");
}
 
Example #30
Source File: SpringJUnit5ConstructorInjectionTests.java    From spring-test-junit5 with Apache License 2.0 4 votes vote down vote up
@Test
void applicationContextInjected() {
	assertNotNull(applicationContext, "ApplicationContext should have been injected by Spring");
	assertEquals(this.dilbert, applicationContext.getBean("dilbert", Person.class));
}