public void testfindPersonBackgroundItems()
{
final long personId = 142L;
final String openSocialId = "2d359911-0977-418a-9490-57e8252b1142";
Person person = jpaPersonMapper.findById(personId);
Background background = new Background(person);
jpaBackgroundMapper.insert(background);
List<BackgroundItem> expectedBackgroundItems = new ArrayList<BackgroundItem>();
expectedBackgroundItems.add(new BackgroundItem("sports", BackgroundItemType.INTEREST));
expectedBackgroundItems.add(new BackgroundItem("music", BackgroundItemType.INTEREST));
expectedBackgroundItems.add(new BackgroundItem("software", BackgroundItemType.INTEREST));
background.setBackgroundItems(expectedBackgroundItems, BackgroundItemType.HONOR);
jpaBackgroundMapper.getEntityManager().flush();
jpaBackgroundMapper.getEntityManager().clear();
background = jpaBackgroundMapper.findPersonBackground(openSocialId);
assertNotNull("No background items found for person with id fordp", background
.getBackgroundItems(BackgroundItemType.HONOR));
// the list.toString() prints out the same thing though they are
// different objects
assertEquals(expectedBackgroundItems.toString(), background.getBackgroundItems(BackgroundItemType.HONOR)
.toString());
}