/*
 * Copyright (c) 2016-2019 Chronicle Software Ltd
 */

package net.openhft.chronicle.wire;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class MessagePathClassifierTest {

    private static VanillaMessageHistory messageHistory(String cs) {
        return Marshallable.fromString(VanillaMessageHistory.class, cs);
    }

    @Test
    public void pathFor() {
        MessagePathClassifier mpc =
                new MessagePathClassifier()
                        .addPathForSourcesEnding(4, 4)
                        .addPathForSourcesEnding(123, 1, 2, 3)
                        .addPathForSourcesEnding(23, 2, 3)
                        .addPathForSourcesEnding(43, 4, 3)
                        .addPathForSourcesEnding(3, 3)
                        .addPathForSourcesEnding(0);
        assertEquals(3, mpc.pathFor(messageHistory("sources: [ 3, 0 ]")));
        assertEquals(43, mpc.pathFor(messageHistory("sources: [ 4, 0, 3, 0 ]")));
        assertEquals(4, mpc.pathFor(messageHistory("sources: [ 3, 0, 4, 0 ]")));
        assertEquals(23, mpc.pathFor(messageHistory("sources: [ 2, 0, 3, 0 ]")));
        assertEquals(123, mpc.pathFor(messageHistory("sources: [ 1, 0, 2, 0, 3, 0 ]")));
        assertEquals(0, mpc.pathFor(messageHistory("sources: [ 1, 0, 2, 0, 5, 0 ]")));
    }

    @Test
    public void addPathForSourcesEnding() {
        new MessagePathClassifier()
                .addPathForSourcesEnding(4, 4)
                .addPathForSourcesEnding(123, 1, 2, 3)
                .addPathForSourcesEnding(4, 4); // warning.
    }

    @Test(expected = IllegalArgumentException.class)
    public void addPathForSourcesEnding2() {
        new MessagePathClassifier()
                .addPathForSourcesEnding(4, 4)
                .addPathForSourcesEnding(123, 1, 2, 3)
                .addPathForSourcesEnding(444, 4); // error.
    }
}
@@ -387,24 +387,16 @@
 For() %7B%0A
-        
 MessageP
@@ -423,24 +423,16 @@
         
-      
-  
 new Mess
@@ -447,32 +447,24 @@
 lassifier()%0A
-        
             
@@ -510,32 +510,24 @@
             
-    
-    
 .addPathForS
@@ -565,32 +565,24 @@
             
-        
 .addPathForS
@@ -616,32 +616,24 @@
             
-  
-      
 .addPathForS
@@ -651,32 +651,24 @@
 g(43, 4, 3)%0A
-        
             
@@ -714,32 +714,24 @@
             
-        
 .addPathForS
@@ -747,24 +747,16 @@
 ing(0);%0A
-        
 assertEq
@@ -810,32 +810,24 @@
 3, 0 %5D%22)));%0A
-        
 assertEquals
@@ -884,32 +884,24 @@
 3, 0 %5D%22)));%0A
-        
 assertEquals
@@ -957,32 +957,24 @@
 4, 0 %5D%22)));%0A
-        
 assertEquals
@@ -1031,32 +1031,24 @@
 3, 0 %5D%22)));%0A
-        
 assertEquals
@@ -1116,24 +1116,16 @@
  %5D%22)));%0A
-        
 assertEq

Fix up version dependencies.