org.springframework.tests.sample.beans.Employee Java Examples

The following examples show how to use org.springframework.tests.sample.beans.Employee. 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: GroovyControlGroupTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("resource")
public void verifyScriptUsingGenericGroovyApplicationContext() {
	ApplicationContext ctx = new GenericGroovyApplicationContext(getClass(), "context.groovy");

	String foo = ctx.getBean("foo", String.class);
	assertEquals("Foo", foo);

	String bar = ctx.getBean("bar", String.class);
	assertEquals("Bar", bar);

	Pet pet = ctx.getBean(Pet.class);
	assertNotNull("pet", pet);
	assertEquals("Dogbert", pet.getName());

	Employee employee = ctx.getBean(Employee.class);
	assertNotNull("employee", employee);
	assertEquals("Dilbert", employee.getName());
	assertEquals("???", employee.getCompany());
}
 
Example #2
Source File: GroovyControlGroupTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
@SuppressWarnings("resource")
public void verifyScriptUsingGenericGroovyApplicationContext() {
	ApplicationContext ctx = new GenericGroovyApplicationContext(getClass(), "context.groovy");

	String foo = ctx.getBean("foo", String.class);
	assertEquals("Foo", foo);

	String bar = ctx.getBean("bar", String.class);
	assertEquals("Bar", bar);

	Pet pet = ctx.getBean(Pet.class);
	assertNotNull("pet", pet);
	assertEquals("Dogbert", pet.getName());

	Employee employee = ctx.getBean(Employee.class);
	assertNotNull("employee", employee);
	assertEquals("Dilbert", employee.getName());
	assertEquals("???", employee.getCompany());
}
 
Example #3
Source File: GroovyControlGroupTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
@SuppressWarnings("resource")
public void verifyScriptUsingGenericGroovyApplicationContext() {
	ApplicationContext ctx = new GenericGroovyApplicationContext(getClass(), "context.groovy");

	String foo = ctx.getBean("foo", String.class);
	assertEquals("Foo", foo);

	String bar = ctx.getBean("bar", String.class);
	assertEquals("Bar", bar);

	Pet pet = ctx.getBean(Pet.class);
	assertNotNull("pet", pet);
	assertEquals("Dogbert", pet.getName());

	Employee employee = ctx.getBean(Employee.class);
	assertNotNull("employee", employee);
	assertEquals("Dilbert", employee.getName());
	assertEquals("???", employee.getCompany());
}
 
Example #4
Source File: ParameterizedSpringRuleTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public final void verifyPetAndEmployee() {
	invocationCount.incrementAndGet();

	// Verifying dependency injection:
	assertNotNull("The pet field should have been autowired.", this.pet);

	// Verifying 'parameterized' support:
	Employee employee = this.applicationContext.getBean(this.employeeBeanName, Employee.class);
	assertEquals("Name of the employee configured as bean [" + this.employeeBeanName + "].", this.employeeName,
		employee.getName());
}
 
Example #5
Source File: ParameterizedDependencyInjectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public final void verifyPetAndEmployee() {
	invocationCount.incrementAndGet();

	// Verifying dependency injection:
	assertNotNull("The pet field should have been autowired.", this.pet);

	// Verifying 'parameterized' support:
	Employee employee = this.applicationContext.getBean(this.employeeBeanName, Employee.class);
	assertEquals("Name of the employee configured as bean [" + this.employeeBeanName + "].", this.employeeName,
		employee.getName());
}
 
Example #6
Source File: ParameterizedSpringRuleTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public final void verifyPetAndEmployee() {
	invocationCount.incrementAndGet();

	// Verifying dependency injection:
	assertNotNull("The pet field should have been autowired.", this.pet);

	// Verifying 'parameterized' support:
	Employee employee = this.applicationContext.getBean(this.employeeBeanName, Employee.class);
	assertEquals("Name of the employee configured as bean [" + this.employeeBeanName + "].", this.employeeName,
		employee.getName());
}
 
Example #7
Source File: ConcreteTransactionalTestNGSpringContextTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void verifyApplicationContextSet() {
	assertInTransaction(false);
	assertNotNull(super.applicationContext,
		"The application context should have been set due to ApplicationContextAware semantics.");
	Employee employeeBean = (Employee) super.applicationContext.getBean("employee");
	assertEquals(employeeBean.getName(), "John Smith", "employee's name.");
}
 
Example #8
Source File: ParameterizedDependencyInjectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public final void verifyPetAndEmployee() {
	invocationCount.incrementAndGet();

	// Verifying dependency injection:
	assertNotNull("The pet field should have been autowired.", this.pet);

	// Verifying 'parameterized' support:
	Employee employee = this.applicationContext.getBean(this.employeeBeanName, Employee.class);
	assertEquals("Name of the employee configured as bean [" + this.employeeBeanName + "].", this.employeeName,
		employee.getName());
}
 
Example #9
Source File: ConcreteTransactionalTestNGSpringContextTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyApplicationContextSet() {
	assertInTransaction(false);
	assertNotNull(super.applicationContext,
			"The application context should have been set due to ApplicationContextAware semantics.");
	Employee employeeBean = (Employee) super.applicationContext.getBean("employee");
	assertEquals(employeeBean.getName(), "John Smith", "employee's name.");
}
 
Example #10
Source File: ConcreteTransactionalTestNGSpringContextTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyApplicationContextSet() {
	assertInTransaction(false);
	assertNotNull(super.applicationContext,
			"The application context should have been set due to ApplicationContextAware semantics.");
	Employee employeeBean = (Employee) super.applicationContext.getBean("employee");
	assertEquals(employeeBean.getName(), "John Smith", "employee's name.");
}
 
Example #11
Source File: ParameterizedSpringRuleTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public final void verifyPetAndEmployee() {
	invocationCount.incrementAndGet();

	// Verifying dependency injection:
	assertNotNull("The pet field should have been autowired.", this.pet);

	// Verifying 'parameterized' support:
	Employee employee = this.applicationContext.getBean(this.employeeBeanName, Employee.class);
	assertEquals("Name of the employee configured as bean [" + this.employeeBeanName + "].", this.employeeName,
		employee.getName());
}
 
Example #12
Source File: ParameterizedDependencyInjectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public final void verifyPetAndEmployee() {
	invocationCount.incrementAndGet();

	// Verifying dependency injection:
	assertNotNull("The pet field should have been autowired.", this.pet);

	// Verifying 'parameterized' support:
	Employee employee = this.applicationContext.getBean(this.employeeBeanName, Employee.class);
	assertEquals("Name of the employee configured as bean [" + this.employeeBeanName + "].", this.employeeName,
		employee.getName());
}
 
Example #13
Source File: AnnotationConfigTestNGSpringContextTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean
Employee employee() {
	return new Employee("John Smith");
}
 
Example #14
Source File: GroovySpringContextTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Autowired
protected void setEmployee(Employee employee) {
	this.employee = employee;
}
 
Example #15
Source File: GroovySpringContextTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Autowired
protected final void setEmployee(final Employee employee) {
	this.employee = employee;
}
 
Example #16
Source File: ConcreteTransactionalJUnit4SpringContextTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Autowired
private final void setEmployee(final Employee employee) {
	this.employee = employee;
}
 
Example #17
Source File: SpringJUnit4ClassRunnerAppCtxTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Autowired
protected final void setEmployee(final Employee employee) {
	this.employee = employee;
}
 
Example #18
Source File: ConcreteTransactionalTestNGSpringContextTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Autowired
private void setEmployee(Employee employee) {
	this.employee = employee;
}
 
Example #19
Source File: ConcreteTransactionalTestNGSpringContextTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Autowired
protected void setEmployee(Employee employee) {
	this.employee = employee;
}
 
Example #20
Source File: AfterReturningGenericTypeMatchingTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public Collection<Employee> getEmployees() {
	return new ArrayList<Employee>();
}
 
Example #21
Source File: ContextConfigurationTestInterface.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean
Employee employee() {
	return new Employee("Dilbert");
}
 
Example #22
Source File: ActiveProfilesInterfaceTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean
@Profile("prod")
Employee employee2() {
	return new Employee("prod");
}
 
Example #23
Source File: ActiveProfilesInterfaceTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean
@Profile("dev")
Employee employee1() {
	return new Employee("dev");
}
 
Example #24
Source File: GroovySpringContextTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Autowired
protected void setEmployee(Employee employee) {
	this.employee = employee;
}
 
Example #25
Source File: ConcreteTransactionalJUnit4SpringContextTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Autowired
private void setEmployee(Employee employee) {
	this.employee = employee;
}
 
Example #26
Source File: SpringJUnit4ClassRunnerAppCtxTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Autowired
protected void setEmployee(Employee employee) {
	this.employee = employee;
}
 
Example #27
Source File: SpringJUnit4ClassRunnerAppCtxTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Autowired
protected void setEmployee(Employee employee) {
	this.employee = employee;
}
 
Example #28
Source File: AfterReturningGenericTypeMatchingTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public Collection<Employee> getEmployees() {
	return new ArrayList<>();
}
 
Example #29
Source File: ConcreteTransactionalJUnit4SpringContextTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Autowired
private void setEmployee(Employee employee) {
	this.employee = employee;
}
 
Example #30
Source File: ConcreteTransactionalTestNGSpringContextTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Autowired
private void setEmployee(Employee employee) {
	this.employee = employee;
}