*/
public class TestUrlWithScore extends TestCase {
public void testSerialization() throws IOException {
// create a key and test basic functionality
UrlWithScore keyOut = new UrlWithScore("http://example.org/", 1f);
assertEquals("http://example.org/", keyOut.getUrl().toString());
assertEquals(1f, keyOut.getScore().get(), 0.001);
// write to out
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(bos);
keyOut.write(out);
// read from in
UrlWithScore keyIn = new UrlWithScore();
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
DataInputStream in = new DataInputStream(bis);
keyIn.readFields(in);
assertEquals(keyOut.getUrl().toString(), keyIn.getUrl().toString());
assertEquals(keyOut.getScore().get(), keyIn.getScore().get(), 0.001);
in.close();
out.close();
}