forked from eugenp/tutorials
-
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.
Revert "BAEL-2522 - Reverting changes"
This reverts commit bac1103.
- Loading branch information
Antonio Moreno
committed
Mar 16, 2019
1 parent
bac1103
commit d5e91a8
Showing
4 changed files
with
119 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
*.class | ||
|
||
0.* | ||
|
||
#folders# | ||
/target | ||
/neoDb* | ||
/data | ||
/src/main/webapp/WEB-INF/classes | ||
*/META-INF/* | ||
.resourceCache | ||
|
||
# Packaged files # | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
# Files generated by integration tests | ||
*.txt | ||
backup-pom.xml | ||
/bin/ | ||
/temp | ||
|
||
#IntelliJ specific | ||
.idea/ | ||
*.iml | ||
|
||
#jenv | ||
.java-version |
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,55 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>java-dates-2</artifactId> | ||
<version>0.1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>java-dates-2</name> | ||
|
||
<parent> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>parent-java</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<relativePath>../parent-java</relativePath> | ||
</parent> | ||
|
||
<dependencies> | ||
<!-- test scoped --> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${assertj.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>java-dates-2</finalName> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${maven-compiler-plugin.version}</version> | ||
<configuration> | ||
<source>${maven.compiler.source}</source> | ||
<target>${maven.compiler.target}</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<properties> | ||
<!-- testing --> | ||
<assertj.version>3.6.1</assertj.version> | ||
<maven.compiler.source>1.9</maven.compiler.source> | ||
<maven.compiler.target>1.9</maven.compiler.target> | ||
</properties> | ||
</project> |
34 changes: 34 additions & 0 deletions
34
...rc/test/java/com/baeldung/xmlgregoriancalendar/XmlGregorianCalendarConverterUnitTest.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,34 @@ | ||
package com.baeldung.xmlgregoriancalendar; | ||
|
||
import org.junit.Test; | ||
|
||
import javax.xml.datatype.DatatypeConfigurationException; | ||
import javax.xml.datatype.DatatypeFactory; | ||
import javax.xml.datatype.XMLGregorianCalendar; | ||
import java.time.LocalDate; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class XmlGregorianCalendarConverterUnitTest { | ||
|
||
@Test | ||
public void fromLocalDateToXMLGregorianCalendar() throws DatatypeConfigurationException { | ||
LocalDate localDate = LocalDate.of(2017, 4, 25); | ||
XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(localDate.toString()); | ||
|
||
assertThat(xmlGregorianCalendar.getYear()).isEqualTo(localDate.getYear()); | ||
assertThat(xmlGregorianCalendar.getMonth()).isEqualTo(localDate.getMonthValue()); | ||
assertThat(xmlGregorianCalendar.getDay()).isEqualTo(localDate.getDayOfMonth()); | ||
} | ||
|
||
@Test | ||
public void fromXMLGregorianCalendarToLocalDate() throws DatatypeConfigurationException { | ||
XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar("2017-04-25"); | ||
LocalDate localDate = LocalDate.of(xmlGregorianCalendar.getYear(), xmlGregorianCalendar.getMonth(), xmlGregorianCalendar.getDay()); | ||
|
||
assertThat(localDate.getYear()).isEqualTo(xmlGregorianCalendar.getYear()); | ||
assertThat(localDate.getMonthValue()).isEqualTo(xmlGregorianCalendar.getMonth()); | ||
assertThat(localDate.getDayOfMonth()).isEqualTo(xmlGregorianCalendar.getDay()); | ||
} | ||
|
||
} |
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