forked from highsource/jaxb-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixup of initial jt-264-basics merge PR highsource#282
- Loading branch information
Laurent SCHOELENS
committed
Aug 4, 2023
1 parent
ecc6839
commit 68121f2
Showing
110 changed files
with
432 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
basics/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/DefaultCopyStrategyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.jvnet.jaxb2_commons.lang.tests; | ||
|
||
import com.vividsolutions.jts.geom.Coordinate; | ||
import com.vividsolutions.jts.geom.GeometryFactory; | ||
import com.vividsolutions.jts.geom.Polygon; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.jvnet.jaxb2_commons.lang.DefaultCopyStrategy; | ||
import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; | ||
import org.jvnet.jaxb2_commons.lang.tests.pojo.CloneableNoClone; | ||
|
||
import javax.xml.datatype.DatatypeConfigurationException; | ||
import javax.xml.datatype.DatatypeFactory; | ||
import javax.xml.datatype.XMLGregorianCalendar; | ||
|
||
public class DefaultCopyStrategyTest { | ||
|
||
@Test | ||
public void testPolygonOK() { | ||
final GeometryFactory geometryFactory = new GeometryFactory(); | ||
final Polygon polygon = geometryFactory.createPolygon( | ||
geometryFactory.createLinearRing(new Coordinate[] { | ||
new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), | ||
|
||
new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), | ||
new Coordinate(0, 0, 0) }), null); | ||
|
||
polygon.clone(); | ||
|
||
new DefaultCopyStrategy().copy(null, polygon); | ||
} | ||
|
||
@Test | ||
public void testXMLGregorianCalendarOK() throws DatatypeConfigurationException { | ||
final XMLGregorianCalendar calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(); | ||
|
||
new DefaultCopyStrategy().copy(null, calendar); | ||
} | ||
@Test | ||
public void testCloneableNoCloneKO() { | ||
final CloneableNoClone object = new CloneableNoClone("no-clone-method-in-it"); | ||
|
||
Assert.assertThrows("Exception UnsupportedOperationException not thrown", | ||
UnsupportedOperationException.class, () -> new DefaultCopyStrategy().copy(null, object)); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
basics/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/pojo/CloneableNoClone.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.jvnet.jaxb2_commons.lang.tests.pojo; | ||
|
||
public class CloneableNoClone implements Cloneable { | ||
private final String attribute; | ||
|
||
public CloneableNoClone(String attribute) { | ||
this.attribute = attribute; | ||
} | ||
|
||
public String getAttribute() { | ||
return attribute; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.