@@ -0,0 +1,2760 @@
+/**%0A * Copyright 2017 Palantir Technologies%0A *%0A * Licensed under the BSD-3 License (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://opensource.org/licenses/BSD-3-Clause%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.palantir.atlasdb.timelock.paxos;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0Aimport java.io.IOException;%0Aimport java.util.List;%0A%0Aimport org.junit.Before;%0Aimport org.junit.ClassRule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.TemporaryFolder;%0A%0Aimport com.google.common.collect.Lists;%0Aimport com.palantir.paxos.PaxosLearner;%0Aimport com.palantir.paxos.PaxosLearnerImpl;%0Aimport com.palantir.paxos.PaxosValue;%0A%0Apublic class PaxosSynchronizerTest %7B%0A    @ClassRule%0A    public static final TemporaryFolder TEMPORARY_FOLDER = new TemporaryFolder();%0A%0A    private static final int NUM_NODES = 5;%0A    private static final String LEADER_ID = %22foo%22;%0A    private static final byte%5B%5D PAXOS_DATA = new byte%5B0%5D;%0A    private static final long SEQUENCE_ONE = 1L;%0A    private static final PaxosValue VALUE_ONE = new PaxosValue(LEADER_ID, SEQUENCE_ONE, PAXOS_DATA);%0A    private static final long SEQUENCE_TWO = 2L;%0A    private static final PaxosValue VALUE_TWO = new PaxosValue(LEADER_ID, SEQUENCE_TWO, PAXOS_DATA);%0A%0A    private final List%3CPaxosLearner%3E learners = Lists.newArrayList();%0A%0A    private PaxosLearner ourLearner;%0A%0A    @Before%0A    public void setUp() throws IOException %7B%0A        for (int i = 0; i %3C NUM_NODES; i++) %7B%0A            learners.add(PaxosLearnerImpl.newLearner(TEMPORARY_FOLDER.newFolder().getPath()));%0A        %7D%0A        ourLearner = learners.get(0);%0A    %7D%0A%0A    @Test%0A    public void synchronizeDoesNotThrowIfThereIsNoState() %7B%0A        PaxosSynchronizer.synchronizeLearner(ourLearner, learners);%0A    %7D%0A%0A    @Test%0A    public void synchronizeUpdatesOurLearnerToValuesOthersHaveLearned() %7B%0A        learners.get(1).learn(SEQUENCE_ONE, VALUE_ONE);%0A        PaxosSynchronizer.synchronizeLearner(ourLearner, learners);%0A        assertThat(ourLearner.getGreatestLearnedValue()).isEqualTo(VALUE_ONE);%0A    %7D%0A%0A    @Test%0A    public void synchronizeDoesNotUpdateUsIfWeHaveTheMostRecentData() %7B%0A        learners.get(1).learn(SEQUENCE_ONE, VALUE_ONE);%0A        ourLearner.learn(SEQUENCE_TWO, VALUE_TWO);%0A        PaxosSynchronizer.synchronizeLearner(ourLearner, learners);%0A        assertThat(ourLearner.getGreatestLearnedValue()).isEqualTo(VALUE_TWO);%0A    %7D%0A%7D%0A

Add some basic tests for synchronizer