Assert.assertEquals("Expected two entities", 2, targets.size());
}
@Test
public void testFindSelectedByType() throws Exception {
HostConfigMappingEntity entity1 = createEntity(1L, "h1", "global", "version1");
HostConfigMappingEntity target = hostConfigMappingDAO.findSelectedByType(1L, "h1", "core-site");
Assert.assertNull("Expected null entity for type 'core-site'", target);
target = hostConfigMappingDAO.findSelectedByType(1L, "h1", "global");
Assert.assertNotNull("Expected non-null entity for type 'global'", target);
Assert.assertEquals("Expected version to be '" + entity1.getVersion() + "'", entity1.getVersion(), target.getVersion());
target.setSelected(0);
hostConfigMappingDAO.merge(target);
HostConfigMappingEntity entity2 = createEntity(1L, "h1", "global", "version2");
target = hostConfigMappingDAO.findSelectedByType(1L, "h1", "global");
Assert.assertNotNull("Expected non-null entity for type 'global'", target);
Assert.assertEquals("Expected version to be '" + entity2.getVersion() + "'", entity2.getVersion(), target.getVersion());
Assert.assertEquals("Expected instance equality", entity2, target);
}