1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.debug.test;
import junit.framework.TestCase;
import com.yahoo.search.debug.SearchChainTextRepresentation;
import com.yahoo.search.searchchain.SearchChainRegistry;
import com.yahoo.search.searchchain.test.SimpleSearchChain;
/**
* Test of SearchChainTextRepresentation.
* @author tonytv
*/
public class SearchChainTextRepresentationTestCase extends TestCase {
public void testTextRepresentation() {
SearchChainTextRepresentation textRepresentation =
new SearchChainTextRepresentation(SimpleSearchChain.orderedChain, new SearchChainRegistry());
String[] expected = {
"test [Searchchain] {",
" one [Searcher] {",
" Reason for forwarding to this search chain.",
" child-chain [Searchchain] {",
" child-searcher [Searcher]",
" }",
" child-chain [Searchchain] {",
" child-searcher [Searcher]",
" }",
" }",
" two [Searcher] {",
" Reason for forwarding to this search chain.",
" child-chain [Searchchain] {",
" child-searcher [Searcher]",
" }",
" child-chain [Searchchain] {",
" child-searcher [Searcher]",
" }",
" }",
"}"
};
String[] result = textRepresentation.toString().split("\n");
assertEquals(expected.length, result.length);
int i = 0;
for (String line : textRepresentation.toString().split("\n"))
assertEquals(expected[i++], line);
}
}
|