/**
 * Copyright (C) 2009  HungryHobo@mail.i2p
 * 
 * The GPG fingerprint for HungryHobo@mail.i2p is:
 * 6DD3 EAA2 9990 29BC 4AD2 7486 1E2C 7B61 76DC DC12
 * 
 * This file is part of I2P-Bote.
 * I2P-Bote is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * I2P-Bote is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with I2P-Bote.  If not, see <http://www.gnu.org/licenses/>.
 */

package i2p.bote.packet;

import static junit.framework.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

import net.i2p.data.Destination;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class PeerListTest {
    PeerList peerList;

    @Before
    public void setUp() throws Exception {
        Collection<Destination> peers = new ArrayList<Destination>();
        peers.add(new Destination("PX~Oa14i79JumDyAntlanQS1tecQVBNBmZm7g31pcaOl03JPGqTaZYXYn2zVPsAURiuhSltfbEj7sIqcGhbv2KWeRJjqc-4wEHix41qGo2Unzgo~6wkHTv72wwtWCUSNZ~Tbx1XUxsf8m2LVYm~G8xy-OkK2YJ9rrRTnfNn7oSOwvngtMbDXRriJuEBnccHhYw0UoqUzcWtTzml7xlwZyNg~O5vWEOeifeMq~8fcCbqSTCAkE3eMzdNPCehMUgDgu4cVPmy-28vqp6zYcg1jSoITi265sw9tZcY6LtPhENc3qyh-cR0VI~1R4tGJ-m6xio8MzyuMJEhFay8U1C4NhxnV4KN37VR2go-KKfM83XSf6w0vemFu0hmUQ0fzKeRw95Gmn-U~EJ2zMXIrxb3ElguGJNRXodah9t4AgBqzsOXIUv4yDouhw5hPVlhG0biTvU9ozHz6ZBDPrblvieGWhYcNA79pma3QmIyfeNuKGxgq7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giqP1HNfApLH37gsAAAA"));
        peerList = new PeerList(peers);
    }

    @After
    public void tearDown() throws Exception {
    }

    @Test
    public void toByteArrayAndBack() throws Exception {
        byte[] arrayA = peerList.toByteArray();
        byte[] arrayB;
        arrayB = new PeerList(arrayA).toByteArray();
        assertTrue("The two arrays differ!", Arrays.equals(arrayA, arrayB));
    }
}