Search in sources :

Example 1 with Employee

use of cn.taketoday.beans.testfixture.beans.Employee in project today-infrastructure by TAKETODAY.

the class ParameterizedDependencyInjectionTests method verifyPetAndEmployee.

@Test
public final void verifyPetAndEmployee() {
    invocationCount.incrementAndGet();
    // Verifying dependency injection:
    assertThat(this.pet).as("The pet field should have been autowired.").isNotNull();
    // Verifying 'parameterized' support:
    Employee employee = this.applicationContext.getBean(this.employeeBeanName, Employee.class);
    assertThat(employee.getName()).as("Name of the employee configured as bean [" + this.employeeBeanName + "].").isEqualTo(this.employeeName);
}
Also used : Employee(cn.taketoday.beans.testfixture.beans.Employee) Test(org.junit.Test)

Example 2 with Employee

use of cn.taketoday.beans.testfixture.beans.Employee in project today-infrastructure by TAKETODAY.

the class ConcreteTransactionalTestNGContextTests method verifyApplicationContextSet.

@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void verifyApplicationContextSet() {
    TransactionAssert.assertThatTransaction().isNotActive();
    assertThat(super.applicationContext).as("The application context should have been set due to ApplicationContextAware semantics.").isNotNull();
    Employee employeeBean = (Employee) super.applicationContext.getBean("employee");
    assertThat(employeeBean.getName()).as("employee's name.").isEqualTo("John Smith");
}
Also used : Employee(cn.taketoday.beans.testfixture.beans.Employee) Test(org.testng.annotations.Test) Transactional(cn.taketoday.transaction.annotation.Transactional)

Example 3 with Employee

use of cn.taketoday.beans.testfixture.beans.Employee in project today-infrastructure by TAKETODAY.

the class DevProfileConfig method employee.

@Bean
public Employee employee() {
    Employee employee = new Employee();
    employee.setName("John Smith");
    employee.setAge(42);
    employee.setCompany("Acme Widgets, Inc.");
    return employee;
}
Also used : Employee(cn.taketoday.beans.testfixture.beans.Employee) Bean(cn.taketoday.context.annotation.Bean)

Example 4 with Employee

use of cn.taketoday.beans.testfixture.beans.Employee in project today-framework by TAKETODAY.

the class ParameterizedSpringRuleTests method verifyPetAndEmployee.

@Test
public final void verifyPetAndEmployee() {
    invocationCount.incrementAndGet();
    // Verifying dependency injection:
    assertThat(this.pet).as("The pet field should have been autowired.").isNotNull();
    // Verifying 'parameterized' support:
    Employee employee = this.applicationContext.getBean(this.employeeBeanName, Employee.class);
    assertThat(employee.getName()).as("Name of the employee configured as bean [" + this.employeeBeanName + "].").isEqualTo(this.employeeName);
}
Also used : Employee(cn.taketoday.beans.testfixture.beans.Employee) Test(org.junit.Test)

Example 5 with Employee

use of cn.taketoday.beans.testfixture.beans.Employee in project today-framework by TAKETODAY.

the class ConcreteTransactionalTestNGContextTests method verifyApplicationContextSet.

@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void verifyApplicationContextSet() {
    TransactionAssert.assertThatTransaction().isNotActive();
    assertThat(super.applicationContext).as("The application context should have been set due to ApplicationContextAware semantics.").isNotNull();
    Employee employeeBean = (Employee) super.applicationContext.getBean("employee");
    assertThat(employeeBean.getName()).as("employee's name.").isEqualTo("John Smith");
}
Also used : Employee(cn.taketoday.beans.testfixture.beans.Employee) Test(org.testng.annotations.Test) Transactional(cn.taketoday.transaction.annotation.Transactional)

Aggregations

Employee (cn.taketoday.beans.testfixture.beans.Employee)10 Bean (cn.taketoday.context.annotation.Bean)4 Test (org.junit.Test)4 Transactional (cn.taketoday.transaction.annotation.Transactional)2 Test (org.testng.annotations.Test)2