1 /*******************************************************************************
2 * Copyright © 2018 IBM.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************
20 package org.onap.portalsdk.analytics.model.search;
22 import static org.junit.Assert.assertEquals;
23 import static org.junit.Assert.assertTrue;
25 import org.junit.Assert;
26 import org.junit.Before;
27 import org.junit.Test;
29 public class SearchResultFieldTest {
30 private SearchResultField searchResultField;
34 searchResultField = new SearchResultField();
38 public void testValuesWhenColumnIdIsEdit() {
39 SearchResultColumn col = new SearchResultColumn("edit", "Column1", "10", "left",
40 "url", "column1", "linkForm", "linkConfirmMsg",
41 "linkImg", "10", "10", true,
43 SearchResultField field = new SearchResultField("displayValue", "linkIdValue", col, true);
44 Assert.assertEquals("report#/report_wizard/linkIdValue", field.getDrillDownLink());
45 Assert.assertEquals("linkImg", field.getDrillDownImage());
46 Assert.assertEquals(null, field.getConfirmationText());
50 public void testValuesWhenColumnIdIsCopy() {
51 SearchResultColumn col = new SearchResultColumn("copy", "Column1", "10", "left",
52 "url", "column1", "linkForm", "linkConfirmMsg",
53 "linkImg", "10", "10", true,
55 SearchResultField field = new SearchResultField("displayValue", "linkIdValue", col, true);
56 Assert.assertEquals("report#/report_wizard/copy/linkIdValue", field.getDrillDownLink());
57 Assert.assertEquals("linkImg", field.getDrillDownImage());
58 Assert.assertEquals("linkConfirmMsg", field.getConfirmationText());
62 public void testValuesWhenColumnIdIsDelete() {
63 SearchResultColumn col = new SearchResultColumn("delete", "Column1", "10", "left",
64 "url", "column1", "linkForm", "linkConfirmMsg",
65 "linkImg", "10", "10", true,
67 SearchResultField field = new SearchResultField("displayValue", "linkIdValue", col, true);
68 Assert.assertEquals("raptor.htm?action=report.delete&c_master=linkIdValue", field.getDrillDownLink());
69 Assert.assertEquals("linkImg", field.getDrillDownImage());
70 Assert.assertEquals("linkConfirmMsg", field.getConfirmationText());