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 testSetConfirmationText() {
39 searchResultField.setConfirmationText("test");
41 expected=searchResultField.getConfirmationText();
42 assertEquals(expected,"test");
46 public void testSetDrillDownImage() {
47 searchResultField.setDrillDownImage("confirm");
49 expected=searchResultField.getDrillDownImage();
50 assertEquals(expected,"confirm");
54 public void testValuesWhenColumnIdIsEdit() {
55 SearchResultColumn col = new SearchResultColumn("edit", "Column1", "10", "left",
56 "url", "column1", "linkForm", "linkConfirmMsg",
57 "linkImg", "10", "10", true,
59 SearchResultField field = new SearchResultField("displayValue", "linkIdValue", col, true);
60 Assert.assertEquals("report#/report_wizard/linkIdValue", field.getDrillDownLink());
61 Assert.assertEquals("linkImg", field.getDrillDownImage());
62 Assert.assertEquals(null, field.getConfirmationText());
66 public void testValuesWhenColumnIdIsCopy() {
67 SearchResultColumn col = new SearchResultColumn("copy", "Column1", "10", "left",
68 "url", "column1", "linkForm", "linkConfirmMsg",
69 "linkImg", "10", "10", true,
71 SearchResultField field = new SearchResultField("displayValue", "linkIdValue", col, true);
72 Assert.assertEquals("report#/report_wizard/copy/linkIdValue", field.getDrillDownLink());
73 Assert.assertEquals("linkImg", field.getDrillDownImage());
74 Assert.assertEquals("linkConfirmMsg", field.getConfirmationText());
78 public void testValuesWhenColumnIdIsDelete() {
79 SearchResultColumn col = new SearchResultColumn("delete", "Column1", "10", "left",
80 "url", "column1", "linkForm", "linkConfirmMsg",
81 "linkImg", "10", "10", true,
83 SearchResultField field = new SearchResultField("displayValue", "linkIdValue", col, true);
84 Assert.assertEquals("raptor.htm?action=report.delete&c_master=linkIdValue", field.getDrillDownLink());
85 Assert.assertEquals("linkImg", field.getDrillDownImage());
86 Assert.assertEquals("linkConfirmMsg", field.getConfirmationText());