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

The following examples show how to use org.springframework.tests.sample.beans.Pet. 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: RadioButtonTagTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void collectionOfPetsNotSelected() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Santa's Little Helper"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("radio", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Santa's Little Helper", checkboxElement.attribute("value").getValue());
	assertNull(checkboxElement.attribute("checked"));
}
 
Example #2
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 #3
Source File: CheckboxTagTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void collectionOfPetsNotSelected() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Santa's Little Helper"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("checkbox", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Santa's Little Helper", checkboxElement.attribute("value").getValue());
	assertNull(checkboxElement.attribute("checked"));
}
 
Example #4
Source File: CheckboxTagTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void collectionOfPets() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Rudiger"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("checkbox", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Rudiger", checkboxElement.attribute("value").getValue());
	assertEquals("checked", checkboxElement.attribute("checked").getValue());
}
 
Example #5
Source File: RadioButtonTagTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void collectionOfPetsNotSelected() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Santa's Little Helper"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("radio", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Santa's Little Helper", checkboxElement.attribute("value").getValue());
	assertNull(checkboxElement.attribute("checked"));
}
 
Example #6
Source File: RadioButtonTagTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void collectionOfPets() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Rudiger"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("radio", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Rudiger", checkboxElement.attribute("value").getValue());
	assertEquals("checked", checkboxElement.attribute("checked").getValue());
}
 
Example #7
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 #8
Source File: CheckboxTagTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void collectionOfPetsNotSelected() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Santa's Little Helper"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("checkbox", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Santa's Little Helper", checkboxElement.attribute("value").getValue());
	assertNull(checkboxElement.attribute("checked"));
}
 
Example #9
Source File: CheckboxTagTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void collectionOfPets() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Rudiger"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("checkbox", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Rudiger", checkboxElement.attribute("value").getValue());
	assertEquals("checked", checkboxElement.attribute("checked").getValue());
}
 
Example #10
Source File: RadioButtonTagTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void collectionOfPetsNotSelected() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Santa's Little Helper"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("radio", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Santa's Little Helper", checkboxElement.attribute("value").getValue());
	assertNull(checkboxElement.attribute("checked"));
}
 
Example #11
Source File: RadioButtonTagTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void collectionOfPets() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Rudiger"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("radio", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Rudiger", checkboxElement.attribute("value").getValue());
	assertEquals("checked", checkboxElement.attribute("checked").getValue());
}
 
Example #12
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 #13
Source File: RadioButtonTagTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void collectionOfPets() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Rudiger"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("radio", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Rudiger", checkboxElement.attribute("value").getValue());
	assertEquals("checked", checkboxElement.attribute("checked").getValue());
}
 
Example #14
Source File: CheckboxTagTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void collectionOfPetsNotSelected() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Santa's Little Helper"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("checkbox", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Santa's Little Helper", checkboxElement.attribute("value").getValue());
	assertNull(checkboxElement.attribute("checked"));
}
 
Example #15
Source File: CheckboxTagTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void collectionOfPets() throws Exception {
	this.tag.setPath("pets");
	this.tag.setValue(new Pet("Rudiger"));

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("checkbox", checkboxElement.attribute("type").getValue());
	assertEquals("pets", checkboxElement.attribute("name").getValue());
	assertEquals("Rudiger", checkboxElement.attribute("value").getValue());
	assertEquals("checked", checkboxElement.attribute("checked").getValue());
}
 
Example #16
Source File: CheckboxTagTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	List colours = new ArrayList();
	colours.add(Colour.BLUE);
	colours.add(Colour.RED);
	colours.add(Colour.GREEN);

	List pets = new ArrayList();
	pets.add(new Pet("Rudiger"));
	pets.add(new Pet("Spot"));
	pets.add(new Pet("Fluffy"));
	pets.add(new Pet("Mufty"));

	List someList = new ArrayList();
	someList.add("foo");
	someList.add("bar");

	Map someMap = new LinkedHashMap();
	someMap.put("key", Boolean.TRUE);

	this.bean = new TestBean();
	this.bean.setDate(getDate());
	this.bean.setName("Rob Harrop");
	this.bean.setJedi(true);
	this.bean.setSomeBoolean(Boolean.TRUE);
	this.bean.setStringArray(new String[] {"bar", "foo"});
	this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
	this.bean.setOtherColours(colours);
	this.bean.setPets(pets);
	this.bean.setSomeList(someList);
	this.bean.setSomeMap(someMap);
	return this.bean;
}
 
Example #17
Source File: RadioButtonTagTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	this.bean = new TestBean();
	bean.setSex("M");
	bean.setMyFloat(getFloat());
	bean.setPets(Collections.singletonList(new Pet("Rudiger")));
	return bean;
}
 
Example #18
Source File: RadioButtonsTagTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	List colours = new ArrayList();
	colours.add(Colour.BLUE);
	colours.add(Colour.RED);
	colours.add(Colour.GREEN);

	List pets = new ArrayList();
	pets.add(new Pet("Rudiger"));
	pets.add(new Pet("Spot"));
	pets.add(new Pet("Fluffy"));
	pets.add(new Pet("Mufty"));

	this.bean = new TestBean();
	this.bean.setDate(getDate());
	this.bean.setName("Rob Harrop");
	this.bean.setJedi(true);
	this.bean.setSomeBoolean(Boolean.TRUE);
	this.bean.setStringArray(new String[] {"bar", "foo"});
	this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
	this.bean.setOtherColours(colours);
	this.bean.setPets(pets);
	List list = new ArrayList();
	list.add("foo");
	list.add("bar");
	this.bean.setSomeList(list);
	return this.bean;
}
 
Example #19
Source File: CheckboxesTagTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	List colours = new ArrayList();
	colours.add(Colour.BLUE);
	colours.add(Colour.RED);
	colours.add(Colour.GREEN);

	List pets = new ArrayList();
	pets.add(new Pet("Rudiger"));
	pets.add(new Pet("Spot"));
	pets.add(new Pet("Fluffy"));
	pets.add(new Pet("Mufty"));

	Set someObjects = new HashSet();
	someObjects.add(new ItemPet("PET1"));
	someObjects.add(new ItemPet("PET2"));

	this.bean = new TestBean();
	this.bean.setDate(getDate());
	this.bean.setName("Rob Harrop");
	this.bean.setJedi(true);
	this.bean.setSomeBoolean(Boolean.TRUE);
	this.bean.setStringArray(new String[] {"bar", "foo"});
	this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
	this.bean.setOtherColours(colours);
	this.bean.setPets(pets);
	this.bean.setSomeSet(someObjects);
	List list = new ArrayList();
	list.add("foo");
	list.add("bar");
	this.bean.setSomeList(list);
	return this.bean;
}
 
Example #20
Source File: CheckboxTagTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	List colours = new ArrayList();
	colours.add(Colour.BLUE);
	colours.add(Colour.RED);
	colours.add(Colour.GREEN);

	List pets = new ArrayList();
	pets.add(new Pet("Rudiger"));
	pets.add(new Pet("Spot"));
	pets.add(new Pet("Fluffy"));
	pets.add(new Pet("Mufty"));

	List someList = new ArrayList();
	someList.add("foo");
	someList.add("bar");

	Map someMap = new LinkedHashMap();
	someMap.put("key", Boolean.TRUE);

	this.bean = new TestBean();
	this.bean.setDate(getDate());
	this.bean.setName("Rob Harrop");
	this.bean.setJedi(true);
	this.bean.setSomeBoolean(Boolean.TRUE);
	this.bean.setStringArray(new String[] {"bar", "foo"});
	this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
	this.bean.setOtherColours(colours);
	this.bean.setPets(pets);
	this.bean.setSomeList(someList);
	this.bean.setSomeMap(someMap);
	return this.bean;
}
 
Example #21
Source File: RadioButtonsTagTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	List colours = new ArrayList();
	colours.add(Colour.BLUE);
	colours.add(Colour.RED);
	colours.add(Colour.GREEN);

	List pets = new ArrayList();
	pets.add(new Pet("Rudiger"));
	pets.add(new Pet("Spot"));
	pets.add(new Pet("Fluffy"));
	pets.add(new Pet("Mufty"));

	this.bean = new TestBean();
	this.bean.setDate(getDate());
	this.bean.setName("Rob Harrop");
	this.bean.setJedi(true);
	this.bean.setSomeBoolean(Boolean.TRUE);
	this.bean.setStringArray(new String[] {"bar", "foo"});
	this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
	this.bean.setOtherColours(colours);
	this.bean.setPets(pets);
	List list = new ArrayList();
	list.add("foo");
	list.add("bar");
	this.bean.setSomeList(list);
	return this.bean;
}
 
Example #22
Source File: CheckboxesTagTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	List colours = new ArrayList();
	colours.add(Colour.BLUE);
	colours.add(Colour.RED);
	colours.add(Colour.GREEN);

	List pets = new ArrayList();
	pets.add(new Pet("Rudiger"));
	pets.add(new Pet("Spot"));
	pets.add(new Pet("Fluffy"));
	pets.add(new Pet("Mufty"));

	Set someObjects = new HashSet();
	someObjects.add(new ItemPet("PET1"));
	someObjects.add(new ItemPet("PET2"));

	this.bean = new TestBean();
	this.bean.setDate(getDate());
	this.bean.setName("Rob Harrop");
	this.bean.setJedi(true);
	this.bean.setSomeBoolean(Boolean.TRUE);
	this.bean.setStringArray(new String[] {"bar", "foo"});
	this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
	this.bean.setOtherColours(colours);
	this.bean.setPets(pets);
	this.bean.setSomeSet(someObjects);
	List list = new ArrayList();
	list.add("foo");
	list.add("bar");
	this.bean.setSomeList(list);
	return this.bean;
}
 
Example #23
Source File: RadioButtonTagTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	this.bean = new TestBean();
	bean.setSex("M");
	bean.setMyFloat(getFloat());
	bean.setPets(Collections.singletonList(new Pet("Rudiger")));
	return bean;
}
 
Example #24
Source File: CheckboxesTagTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	List colours = new ArrayList();
	colours.add(Colour.BLUE);
	colours.add(Colour.RED);
	colours.add(Colour.GREEN);

	List pets = new ArrayList();
	pets.add(new Pet("Rudiger"));
	pets.add(new Pet("Spot"));
	pets.add(new Pet("Fluffy"));
	pets.add(new Pet("Mufty"));

	Set someObjects = new HashSet();
	someObjects.add(new ItemPet("PET1"));
	someObjects.add(new ItemPet("PET2"));

	this.bean = new TestBean();
	this.bean.setDate(getDate());
	this.bean.setName("Rob Harrop");
	this.bean.setJedi(true);
	this.bean.setSomeBoolean(new Boolean(true));
	this.bean.setStringArray(new String[] {"bar", "foo"});
	this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
	this.bean.setOtherColours(colours);
	this.bean.setPets(pets);
	this.bean.setSomeSet(someObjects);
	List list = new ArrayList();
	list.add("foo");
	list.add("bar");
	this.bean.setSomeList(list);
	return this.bean;
}
 
Example #25
Source File: RadioButtonsTagTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	List colours = new ArrayList();
	colours.add(Colour.BLUE);
	colours.add(Colour.RED);
	colours.add(Colour.GREEN);

	List pets = new ArrayList();
	pets.add(new Pet("Rudiger"));
	pets.add(new Pet("Spot"));
	pets.add(new Pet("Fluffy"));
	pets.add(new Pet("Mufty"));

	this.bean = new TestBean();
	this.bean.setDate(getDate());
	this.bean.setName("Rob Harrop");
	this.bean.setJedi(true);
	this.bean.setSomeBoolean(new Boolean(true));
	this.bean.setStringArray(new String[] {"bar", "foo"});
	this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
	this.bean.setOtherColours(colours);
	this.bean.setPets(pets);
	List list = new ArrayList();
	list.add("foo");
	list.add("bar");
	this.bean.setSomeList(list);
	return this.bean;
}
 
Example #26
Source File: CheckboxTagTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	List colours = new ArrayList();
	colours.add(Colour.BLUE);
	colours.add(Colour.RED);
	colours.add(Colour.GREEN);

	List pets = new ArrayList();
	pets.add(new Pet("Rudiger"));
	pets.add(new Pet("Spot"));
	pets.add(new Pet("Fluffy"));
	pets.add(new Pet("Mufty"));

	List someList = new ArrayList();
	someList.add("foo");
	someList.add("bar");

	Map someMap = new LinkedHashMap();
	someMap.put("key", Boolean.TRUE);

	this.bean = new TestBean();
	this.bean.setDate(getDate());
	this.bean.setName("Rob Harrop");
	this.bean.setJedi(true);
	this.bean.setSomeBoolean(new Boolean(true));
	this.bean.setStringArray(new String[] {"bar", "foo"});
	this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
	this.bean.setOtherColours(colours);
	this.bean.setPets(pets);
	this.bean.setSomeList(someList);
	this.bean.setSomeMap(someMap);
	return this.bean;
}
 
Example #27
Source File: RadioButtonTagTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
protected TestBean createTestBean() {
	this.bean = new TestBean();
	bean.setSex("M");
	bean.setMyFloat(getFloat());
	bean.setPets(Collections.singletonList(new Pet("Rudiger")));
	return bean;
}
 
Example #28
Source File: AnnotationConfigTransactionalTestNGSpringContextTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean
public Pet pet() {
	return new Pet("Fido");
}
 
Example #29
Source File: DefaultProfileConfig.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean
public Pet pet() {
	return new Pet("Fido");
}
 
Example #30
Source File: DefaultProfileConfig.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean
public Pet pet() {
	return new Pet("Fido");
}