All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test.it.unimi.dsi.big.mg4j.index.payload.DatePayloadTest Maven / Gradle / Ivy

Go to download

MG4J (Managing Gigabytes for Java) is a free full-text search engine for large document collections written in Java. The big version is a fork of the original MG4J that can handle more than 2^31 terms and documents.

The newest version!
package it.unimi.dsi.big.mg4j.index.payload;

import static org.junit.Assert.assertEquals;

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