Skip to content

Commit

Permalink
HBX-1255: Clean up class org.hibernate.tool.hbm2x.hbm2hbmxml.TypePara…
Browse files Browse the repository at this point in the history
…msTest
  • Loading branch information
koentsje committed May 3, 2016
1 parent 9cfd0b6 commit 9b1d2e5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/TypeParamsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.hibernate.tool.NonReflectiveTestCase;
import org.hibernate.tool.hbm2x.Exporter;
import org.hibernate.tool.hbm2x.HibernateMappingExporter;
import org.hibernate.tool.util.MetadataHelper;

/**
* @author Dmitry Geraskov
Expand Down Expand Up @@ -75,7 +76,7 @@ public void testAllFilesExistence() {
public void testReadable() {
Configuration cfg = new Configuration();
cfg.addFile(new File(getOutputDir(), getBaseForMappings() + "Order.hbm.xml"));
cfg.buildMappings();
MetadataHelper.getMetadata(cfg);
}

public void testTypeParamsElements() throws DocumentException {
Expand All @@ -87,7 +88,7 @@ public void testTypeParamsElements() throws DocumentException {
Document document = xmlReader.read(outputXml);

XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/property");
List list = xpath.selectNodes(document);
List<?> list = xpath.selectNodes(document);
assertEquals("Expected to get one property element", 2, list.size());
Element statusElement = (Element) list.get(0);
Element nameElement = (Element) list.get(1);
Expand All @@ -104,13 +105,13 @@ public void testTypeParamsElements() throws DocumentException {
list = ((Element) list.get(0)).elements("param");
assertEquals("Expected to get 5 params elements", list.size(), 5);

Map params = new HashMap();
Map<String, String> params = new HashMap<String, String>();
for (int i = 0; i < list.size(); i++) {
Element param = (Element) list.get(i);
params.put(param.attribute( "name" ).getText(), param.getText());
}

Set set = params.entrySet();
Set<Entry<String, String>> set = params.entrySet();
assertEquals("Expected to get 5 different params elements", set.size(), 5);

assertTrue("Can't find 'catalog' param",
Expand Down Expand Up @@ -142,7 +143,7 @@ public static Test suite() {

}

class TestEntry implements Entry{
class TestEntry implements Entry<Object, Object>{

private Object key;

Expand Down Expand Up @@ -182,7 +183,7 @@ public boolean equals(Object obj) {
return false;
}

Entry other = (Entry) obj;
Entry<?,?> other = (Entry<?,?>)obj;
if (key == null) {
if (other.getKey() != null)
return false;
Expand Down

0 comments on commit 9b1d2e5

Please sign in to comment.