
test.it.unimi.dsi.mg4j.index.payload.DatePayloadTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mg4j Show documentation
Show all versions of mg4j Show documentation
MG4J (Managing Gigabytes for Java) is a free full-text search engine for large document collections written in Java.
The newest version!
package it.unimi.dsi.mg4j.index.payload;
import static org.junit.Assert.*;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
import org.junit.Test;
public class DatePayloadTest extends PayloadTestCase {
@Test
public void testReadWrite() throws IOException, ParseException {
DatePayload datePayload = new DatePayload();
Date date = DateFormat.getDateInstance( DateFormat.SHORT ).parse( "1/1/2001" );
datePayload.set( date );
testWriteAndRead( datePayload );
assertEquals( date, datePayload.get() );
date = DateFormat.getDateInstance( DateFormat.SHORT ).parse( "1/1/1901" );
datePayload.set( date );
testWriteAndRead( datePayload );
assertEquals( date, datePayload.get() );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy