blob: 11d163373ac71a2e17bbf841f2943c57974a3acf (
plain) (
blame)
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result.test;
import java.io.IOException;
import com.yahoo.prelude.hitfield.XMLString;
import com.yahoo.prelude.templates.test.TilingTestCase;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.result.Hit;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* @author bratseth
*/
public class ArrayOutputTestCase {
@Test
public void testArrayOutput() throws IOException {
Result r=new Result(new Query("?query=ignored"));
Hit hit=new Hit("test");
hit.setField("phone",new XMLString("\n <item>408-555-1234</item>" + "\n <item>408-555-5678</item>\n "));
r.hits().add(hit);
String rendered = TilingTestCase.getRendered(r);
String[] lines= rendered.split("\n");
assertEquals(" <field name=\"phone\">",lines[4]);
assertEquals(" <item>408-555-1234</item>",lines[5]);
assertEquals(" <item>408-555-5678</item>",lines[6]);
assertEquals(" </field>",lines[7]);
}
}
|