SchematronCriteria extends GeonetEntity { public SchematronCriteria copy() { SchematronCriteria copy = new SchematronCriteria(); copy.setType(getType()); copy.setUiType(getUiType()); copy.setValue(getValue()); copy.setUiValue(getUiValue()); copy.setGroup(getGroup()); return copy; }  @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = ID_SEQ_NAME) int getId(); SchematronCriteria setId(int id); @Override String toString(); @Column(nullable = false, name = "type") @Enumerated(EnumType.STRING) SchematronCriteriaType getType(); void setType(SchematronCriteriaType type); @Column(nullable = false, name = "value") String getValue(); void setValue(String value); String getUiType(); void setUiType(String uiType); String getUiValue(); void setUiValue(String uiValue); @ManyToOne(optional = false, fetch = FetchType.EAGER) @PrimaryKeyJoinColumns(value = { @PrimaryKeyJoinColumn(referencedColumnName = "name"), @PrimaryKeyJoinColumn(referencedColumnName = "schematronId") }) SchematronCriteriaGroup getGroup(); void setGroup(SchematronCriteriaGroup group); boolean accepts(ApplicationContext applicationContext, int metadataId, Element metadata, List<Namespace> metadataNamespaces); boolean accepts(ApplicationContext applicationContext, Element metadata, List<Namespace> metadataNamespaces, Integer groupOwnerId); SchematronCriteria copy(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testCopy() throws Exception { final SchematronCriteria criteria = SchematronCriteriaGroupRepositoryTest.newSchematronCriteria(_inc); final SchematronCriteria copy = criteria.copy(); Element expectedXml = criteria.asXml(); expectedXml.removeChild("id"); Element actualXml = copy.asXml(); actualXml.removeChild("id"); assertEquals(Xml.getString(expectedXml), Xml.getString(actualXml)); }