package hashcodeCollision;

import static org.junit.Assert.*;

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

import org.junit.Test;

public class issueTest {

	@Test
	public void test() throws DatatypeConfigurationException {
		DatatypeFactory dataTypeFactory = DatatypeFactory.newInstance();
		XMLGregorianCalendar cal1 = dataTypeFactory.newXMLGregorianCalendar("2020-04-24T12:53:00+02:00");
		XMLGregorianCalendar cal2 = dataTypeFactory.newXMLGregorianCalendar("2020-06-04T06:58:17.727Z");

		// This will produce identical hash codes
		int hashCode1 = cal1.hashCode();
		int hashCode2 = cal2.hashCode();

		assertNotEquals(
		"Version should be different because XMLGregorianCalendars are different. cal1: " + cal1 + " cal2: " + cal2,
		hashCode1, hashCode2);
	}

}
