/* * ============LICENSE_START========================================== * ONAP Portal SDK * =================================================================== * Copyright © 2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * * https://creativecommons.org/licenses/by/4.0/ * * Unless required by applicable law or agreed to in writing, documentation * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * ============LICENSE_END============================================ * * */ package org.onap.portalsdk.analytics.model.pdf; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; public class PdfBeanTest { PdfBean pdfBean; public static final int NUMBER_IN_HEADER = 0; public static final int NUMBER_IN_FOOTER = 1; public static final int NUMBER_IN_BOTH = 2; private boolean ALTERNATE_COLOR = true; private boolean IS_PORTRAIT = true; private boolean IS_COVER_PAGE_INCLUDED = true; private boolean IS_DISPLAY_CHART = true; private int CURRENT_PAGE = 1; private int WHERE_TO_SHOW_PAGE_NUMBER = 2; private String USER_ID = "userID"; private String TIMESTAMP_PATTERN = "timestampPattern"; private String TITLE = "title"; private String LEFT_FOOTER = "leftFooter"; private String PAGE_SIZE = "pageSize"; private boolean IS_ATTACHMENT_OF_EMAIL = true; private String LOGO1_URL = "logo1Url"; private Integer LOGO1_SIZE = 100; private String LOGO2_URL= "logo2Url"; private Integer LOGO2_SIZE = 200; private String FULL_WEB_CONTEXT_PATH = "fullWebContextPath"; @Before public void init() { pdfBean = new PdfBean(); pdfBean.setAlternateColor(ALTERNATE_COLOR); pdfBean.setPortrait(IS_PORTRAIT); pdfBean.setCoverPageIncluded(IS_COVER_PAGE_INCLUDED); pdfBean.setDisplayChart(IS_DISPLAY_CHART); pdfBean.setCurrentPage(CURRENT_PAGE); pdfBean.setWhereToShowPageNumber(WHERE_TO_SHOW_PAGE_NUMBER); pdfBean.setUserId(USER_ID); pdfBean.setTimestampPattern(TIMESTAMP_PATTERN); pdfBean.setTitle(TITLE); pdfBean.setLeftFooter(LEFT_FOOTER); pdfBean.setPagesize(PAGE_SIZE); pdfBean.setAttachmentOfEmail(IS_ATTACHMENT_OF_EMAIL); pdfBean.setLogo1Url(LOGO1_URL); pdfBean.setLogo1Size(LOGO1_SIZE); pdfBean.setLogo2Url(LOGO2_URL); pdfBean.setLogo2Size(LOGO2_SIZE); pdfBean.setFullWebContextPath(FULL_WEB_CONTEXT_PATH); } @Test public void testPdfBeanProperties() { assertEquals(ALTERNATE_COLOR, pdfBean.isAlternateColor()); assertEquals(IS_PORTRAIT, pdfBean.isPortrait()); assertEquals(IS_COVER_PAGE_INCLUDED, pdfBean.isCoverPageIncluded()); assertEquals(IS_DISPLAY_CHART, pdfBean.isDisplayChart()); assertEquals(CURRENT_PAGE, pdfBean.getCurrentPage()); assertEquals(2, pdfBean.getWhereToShowPageNumber()); assertEquals(USER_ID, pdfBean.getUserId()); assertEquals(TIMESTAMP_PATTERN, pdfBean.getTimestampPattern()); assertEquals(TITLE, pdfBean.getTitle()); assertEquals(LEFT_FOOTER, pdfBean.getLeftFooter()); assertEquals(PAGE_SIZE, pdfBean.getPagesize()); assertEquals(IS_ATTACHMENT_OF_EMAIL, pdfBean.isAttachmentOfEmail()); assertEquals(LOGO1_URL, pdfBean.getLogo1Url()); assertEquals(LOGO1_SIZE, pdfBean.getLogo1Size()); assertEquals(LOGO2_URL, pdfBean.getLogo2Url()); assertEquals(LOGO2_SIZE, pdfBean.getLogo2Size()); assertEquals(FULL_WEB_CONTEXT_PATH, pdfBean.getFullWebContextPath()); } }