Commits

P_W999 committed d363b64

- Copyright update

Comments (0)

Files changed (18)

src/be/pw/jexif/DemoApp.java

-/*******************************************************************************
- * Copyright 2012 P_W999
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package be.pw.jexif;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import be.pw.jexif.enums.Errors;
-import be.pw.jexif.enums.tag.ExifIFD;
-import be.pw.jexif.exception.ExifError;
-import be.pw.jexif.exception.JExifException;
-import be.pw.jexif.internal.constants.ExecutionConstant;
-import be.pw.jexif.internal.util.Cal10nUtil;
-import ch.qos.cal10n.IMessageConveyor;
-import ch.qos.cal10n.MessageConveyor;
-
-import com.google.common.base.Stopwatch;
-import com.google.common.io.Files;
-
-/**
- * The main class file.
- * @author phillip
- */
-class DemoApp {
-
-	private static final Logger LOG = LoggerFactory.getLogger(DemoApp.class);
-
-	/**
-	 * Just a simple test main method that is used during development.
-	 * @param args arguments
-	 * @throws IOException
-	 * @throws ExifError
-	 */
-	public static void main(final String[] args) throws IOException, JExifException, InterruptedException, ExifError {
-		LOG.info("Starting main method");
-		Properties p = new Properties();
-		p.load(new FileInputStream(new File("src/jexiftool.properties")));
-		LOG.trace("Using version {}", p.get("jexiftool.version"));
-
-		System.setProperty(ExecutionConstant.EXIFTOOLPATH, p.getProperty(ExecutionConstant.EXIFTOOLPATH));
-		System.setProperty(ExecutionConstant.EXIFTOOLDEADLOCK, p.getProperty(ExecutionConstant.EXIFTOOLDEADLOCK));
-		Stopwatch watch = new Stopwatch();
-		watch.start();
-		JExifTool tool = new JExifTool();
-		JExifInfo info1 = tool.getInfo(new File("test-resources/read01.JPG"));
-		JExifInfo info2 = tool.getInfo(new File("test-resources/read02.JPG"));
-		JExifInfo info3 = tool.getInfo(new File("test-resources/read03.JPG"));
-		JExifInfo info4 = tool.getInfo(new File("test-resources/read04.JPG"));
-		File tmp = File.createTempFile("jexiftool", ".jpg");
-		tmp.deleteOnExit();
-		Files.copy(new File("test-resources/read04.JPG"), tmp);
-
-		// tool.stop();
-		JExifInfo write1 = tool.getInfo(tmp);
-		LOG.info("ISO value is for read 1 = {}", info1.getTag(ExifIFD.ISO));
-		LOG.info("ISO value is for read 2 = {}", info2.getTag(ExifIFD.ISO));
-		LOG.info("FNUMBER value is for read 1 = {}", info1.getTag(ExifIFD.FNUMBER));
-		LOG.info("EXPOSURE_PROGRAM value is for read 1 = {}", info1.getTag(ExifIFD.EXPOSUREPROGRAM));
-		LOG.info("EXPOSURE_PROGRAM exact value is for read 1 = {}", info1.getExactTag(ExifIFD.EXPOSUREPROGRAM));
-		LOG.info("EXPOSURE_TIME value is for read 2 = {}", info2.getTag(ExifIFD.EXPOSURETIME));
-		LOG.info("EXPOSURE_TIME exact value is for read 2 = {}", info2.getExactTag(ExifIFD.EXPOSURETIME));
-		LOG.info("FNUMBER exact value is for read 1 = {}", info1.getExactTag(ExifIFD.FNUMBER));
-		LOG.info("FOCAL_LENGTH exact value is for read 4 = {}", info4.getExactTag(ExifIFD.FOCALLENGTH));
-		LOG.info("FOCAL_LENGTH exact value is for read 3 = {}", info3.getExactTag(ExifIFD.FOCALLENGTH));
-
-		LOG.info("FOCAL_LENGTH value is for read 4 = {}", info4.getTag(ExifIFD.FOCALLENGTH));
-		LOG.info("Writing 5 to FOCAL_LENGTH for write 1 -> {}", write1.setTag(ExifIFD.FOCALLENGTH, "5.0"));
-		LOG.info("FOCAL_LENGTH value is for write 1 = {}", write1.getTag(ExifIFD.FOCALLENGTH));
-		watch.stop();
-
-		JExifInfo infoError = tool.getInfo(new File("c:\\does\\not\\exist"));
-		try {
-			infoError.getTag(ExifIFD.APERTUREVALUE);
-		} catch (Exception e) {
-			System.out.println(e.getMessage());
-		}
-		tool.stop();
-		IMessageConveyor mc = new MessageConveyor(Locale.ENGLISH);
-		System.out.println(mc.getMessage(Errors.GENERAL, "test"));
-
-		mc = new MessageConveyor(new Locale("nl"));
-		System.out.println(mc.getMessage(Errors.GENERAL, "test"));
-
-		System.out.println(Cal10nUtil.get(Errors.GENERAL, "test"));
-
-		LOG.info("Executing took {} ms", watch.elapsedTime(TimeUnit.MILLISECONDS));
-		LOG.info("Finished main method");
-	}
-
-}
+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package be.pw.jexif;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import be.pw.jexif.enums.Errors;
+import be.pw.jexif.enums.tag.ExifIFD;
+import be.pw.jexif.exception.ExifError;
+import be.pw.jexif.exception.JExifException;
+import be.pw.jexif.internal.constants.ExecutionConstant;
+import be.pw.jexif.internal.util.Cal10nUtil;
+import ch.qos.cal10n.IMessageConveyor;
+import ch.qos.cal10n.MessageConveyor;
+
+import com.google.common.base.Stopwatch;
+import com.google.common.io.Files;
+
+/**
+ * The main class file.
+ * @author phillip
+ */
+class DemoApp {
+
+	private static final Logger LOG = LoggerFactory.getLogger(DemoApp.class);
+
+	/**
+	 * Just a simple test main method that is used during development.
+	 * @param args arguments
+	 * @throws IOException
+	 * @throws ExifError
+	 */
+	public static void main(final String[] args) throws IOException, JExifException, InterruptedException, ExifError {
+		LOG.info("Starting main method");
+		Properties p = new Properties();
+		p.load(new FileInputStream(new File("src/jexiftool.properties")));
+		LOG.trace("Using version {}", p.get("jexiftool.version"));
+
+		System.setProperty(ExecutionConstant.EXIFTOOLPATH, p.getProperty(ExecutionConstant.EXIFTOOLPATH));
+		System.setProperty(ExecutionConstant.EXIFTOOLDEADLOCK, p.getProperty(ExecutionConstant.EXIFTOOLDEADLOCK));
+		Stopwatch watch = new Stopwatch();
+		watch.start();
+		JExifTool tool = new JExifTool();
+		JExifInfo info1 = tool.getInfo(new File("test-resources/read01.JPG"));
+		JExifInfo info2 = tool.getInfo(new File("test-resources/read02.JPG"));
+		JExifInfo info3 = tool.getInfo(new File("test-resources/read03.JPG"));
+		JExifInfo info4 = tool.getInfo(new File("test-resources/read04.JPG"));
+		File tmp = File.createTempFile("jexiftool", ".jpg");
+		tmp.deleteOnExit();
+		Files.copy(new File("test-resources/read04.JPG"), tmp);
+
+		// tool.stop();
+		JExifInfo write1 = tool.getInfo(tmp);
+		LOG.info("ISO value is for read 1 = {}", info1.getTag(ExifIFD.ISO));
+		LOG.info("ISO value is for read 2 = {}", info2.getTag(ExifIFD.ISO));
+		LOG.info("FNUMBER value is for read 1 = {}", info1.getTag(ExifIFD.FNUMBER));
+		LOG.info("EXPOSURE_PROGRAM value is for read 1 = {}", info1.getTag(ExifIFD.EXPOSUREPROGRAM));
+		LOG.info("EXPOSURE_PROGRAM exact value is for read 1 = {}", info1.getExactTag(ExifIFD.EXPOSUREPROGRAM));
+		LOG.info("EXPOSURE_TIME value is for read 2 = {}", info2.getTag(ExifIFD.EXPOSURETIME));
+		LOG.info("EXPOSURE_TIME exact value is for read 2 = {}", info2.getExactTag(ExifIFD.EXPOSURETIME));
+		LOG.info("FNUMBER exact value is for read 1 = {}", info1.getExactTag(ExifIFD.FNUMBER));
+		LOG.info("FOCAL_LENGTH exact value is for read 4 = {}", info4.getExactTag(ExifIFD.FOCALLENGTH));
+		LOG.info("FOCAL_LENGTH exact value is for read 3 = {}", info3.getExactTag(ExifIFD.FOCALLENGTH));
+
+		LOG.info("FOCAL_LENGTH value is for read 4 = {}", info4.getTag(ExifIFD.FOCALLENGTH));
+		LOG.info("Writing 5 to FOCAL_LENGTH for write 1 -> {}", write1.setTag(ExifIFD.FOCALLENGTH, "5.0"));
+		LOG.info("FOCAL_LENGTH value is for write 1 = {}", write1.getTag(ExifIFD.FOCALLENGTH));
+		watch.stop();
+
+		JExifInfo infoError = tool.getInfo(new File("c:\\does\\not\\exist"));
+		try {
+			infoError.getTag(ExifIFD.APERTUREVALUE);
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+		}
+		tool.stop();
+		IMessageConveyor mc = new MessageConveyor(Locale.ENGLISH);
+		System.out.println(mc.getMessage(Errors.GENERAL, "test"));
+
+		mc = new MessageConveyor(new Locale("nl"));
+		System.out.println(mc.getMessage(Errors.GENERAL, "test"));
+
+		System.out.println(Cal10nUtil.get(Errors.GENERAL, "test"));
+
+		LOG.info("Executing took {} ms", watch.elapsedTime(TimeUnit.MILLISECONDS));
+		LOG.info("Finished main method");
+	}
+
+}

src/be/pw/jexif/JExifTool.java

 /*******************************************************************************
  * Copyright 2012 P_W999
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

src/be/pw/jexif/enums/DataType.java

+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
 package be.pw.jexif.enums;
 
 /**

src/be/pw/jexif/enums/Errors.java

+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
 package be.pw.jexif.enums;
 
 import ch.qos.cal10n.BaseName;

src/be/pw/jexif/enums/tag/ExifIFD.java

+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
 package be.pw.jexif.enums.tag;
 
 import static be.pw.jexif.enums.DataType.INT16S;

src/be/pw/jexif/enums/tag/IFD0.java

+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
 package be.pw.jexif.enums.tag;
 
 import static be.pw.jexif.enums.DataType.FLOAT;

src/be/pw/jexif/enums/tag/Tag.java

+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
 package be.pw.jexif.enums.tag;
 
 import be.pw.jexif.enums.DataType;
 	 */
 	DataType getType();
 
-}
+}

src/be/pw/jexif/exception/ExifError.java

+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
 package be.pw.jexif.exception;
 
 /**

src/be/pw/jexif/internal/action/impl/TagReadAction.java

 /*******************************************************************************
  * Copyright 2012 P_W999
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

src/be/pw/jexif/internal/action/impl/TagWriteAction.java

 /*******************************************************************************
  * Copyright 2012 P_W999
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

src/be/pw/jexif/internal/result/ResultHandler.java

 /*******************************************************************************
  * Copyright 2012 P_W999
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

src/be/pw/jexif/internal/result/impl/ParserFactory.java

 /*******************************************************************************
  * Copyright 2012 P_W999
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

src/be/pw/jexif/internal/result/impl/TagReadParser.java

 /*******************************************************************************
  * Copyright 2012 P_W999
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

src/be/pw/jexif/internal/result/impl/TagWriteParser.java

 /*******************************************************************************
  * Copyright 2012 P_W999
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

src/be/pw/jexif/internal/util/Cal10nUtil.java

+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
 package be.pw.jexif.internal.util;
 
 import java.text.MessageFormat;

src/be/pw/jexif/internal/util/DateUtil.java

+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
 package be.pw.jexif.internal.util;
 
 import java.text.ParseException;

src/be/pw/jexif/internal/util/TagUtil.java

+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
 package be.pw.jexif.internal.util;
 
 import java.util.HashMap;

test/be/pw/jexif/internal/util/DateUtilTest.java

-package be.pw.jexif.internal.util;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-public class DateUtilTest {
-	Calendar c;
-
-	@BeforeMethod(alwaysRun = true)
-	public void before() {
-		c = new GregorianCalendar(TimeZone.getTimeZone("GMT+01:00"));
-		c.set(2000, Calendar.JANUARY, 25, 18, 12, 5);
-		c.set(Calendar.MILLISECOND, 55);
-	}
-
-	@Test
-	public void fromDate() {
-		assertThat(DateUtil.fromDate(c.getTime())).isEqualTo("2000:01:25 18:12:05.55 +01:00");
-	}
-
-	@Test
-	public void toDate() throws Exception {
-		Date d1 = DateUtil.toDate("2000:01:25 18:12:05.55 +01:00");
-		Calendar c1 = new GregorianCalendar();
-		c1.setTime(d1);
-		assertThat(c.equals(c1));
-	}
-
-	@Test(dependsOnMethods = { "fromDate", "toDate" })
-	public void testEquality() throws Exception {
-		String s1 = DateUtil.fromDate(c.getTime());
-		Date d2 = DateUtil.toDate(s1);
-		Calendar c2 = new GregorianCalendar();
-		c2.setTime(d2);
-		assertThat(c2.equals(c));
-	}
-}
+/*******************************************************************************
+ * Copyright 2012 P_W999
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package be.pw.jexif.internal.util;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class DateUtilTest {
+	Calendar c;
+
+	@BeforeMethod(alwaysRun = true)
+	public void before() {
+		c = new GregorianCalendar(TimeZone.getTimeZone("GMT+01:00"));
+		c.set(2000, Calendar.JANUARY, 25, 18, 12, 5);
+		c.set(Calendar.MILLISECOND, 55);
+	}
+
+	@Test
+	public void fromDate() {
+		assertThat(DateUtil.fromDate(c.getTime())).isEqualTo("2000:01:25 18:12:05.55 +01:00");
+	}
+
+	@Test
+	public void toDate() throws Exception {
+		Date d1 = DateUtil.toDate("2000:01:25 18:12:05.55 +01:00");
+		Calendar c1 = new GregorianCalendar();
+		c1.setTime(d1);
+		assertThat(c.equals(c1));
+	}
+
+	@Test(dependsOnMethods = { "fromDate", "toDate" })
+	public void testEquality() throws Exception {
+		String s1 = DateUtil.fromDate(c.getTime());
+		Date d2 = DateUtil.toDate(s1);
+		Calendar c2 = new GregorianCalendar();
+		c2.setTime(d2);
+		assertThat(c2.equals(c));
+	}
+}