@Test
    public void testExceedingIterationLimit() {
        {   // Segments found: a x x b   and   c d
            FieldMatchMetricsParameters p=new FieldMatchMetricsParameters();
            p.setMaxAlternativeSegmentations(0);
            FieldMatchMetricsComputer m=new FieldMatchMetricsComputer(p);
            assertMetrics("matches:4 tail:0 proximity:0.75 absoluteProximity:0.075","a b c d","a x x b x x x a x b x x x x x a b x x x x x x x x x x x x x x x x x c d",false,m);
        }

        {   // Segments found: a x b   and   c d
            FieldMatchMetricsParameters p=new FieldMatchMetricsParameters();
            p.setMaxAlternativeSegmentations(1);
            FieldMatchMetricsComputer m=new FieldMatchMetricsComputer(p);
            assertMetrics("matches:4 tail:0 proximity:0.855 absoluteProximity:0.0855","a b c d","a x x b x x x a x b x x x x x a b x x x x x x x x x x x x x x x x x c d",false,m);
        }

        {   // Segments found: a b   and   c d
            FieldMatchMetricsParameters p=new FieldMatchMetricsParameters();
            p.setMaxAlternativeSegmentations(2);
            FieldMatchMetricsComputer m=new FieldMatchMetricsComputer(p);
            assertMetrics("matches:4 tail:0 proximity:1 absoluteProximity:0.1","a b c d","a x x b x x x a x b x x x x x a b x x x x x x x x x x x x x x x x x c d",false,m);
        }
    }
Test cases where we choose between multiple different segmentations
searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/test/FieldMatchMetricsTestCase.java