2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.client.editor.rest.handling.bean;
23 import static org.junit.Assert.assertNotNull;
24 import static org.junit.Assert.assertNull;
25 import static org.junit.Assert.fail;
27 import org.junit.Test;
31 * @author Liam Fallon (liam.fallon@ericsson.com)
33 public class TestBeans {
36 public void testBeans() {
37 assertNotNull(new BeanEvent().toString());
38 assertNotNull(new BeanState().toString());
39 assertNotNull(new BeanContextAlbum().toString());
40 assertNotNull(new BeanPolicy().toString());
41 assertNotNull(new BeanContextSchema().toString());
42 assertNotNull(new BeanField().toString());
43 assertNotNull(new BeanModel().toString());
44 assertNotNull(new BeanLogic().toString());
45 assertNotNull(new BeanStateOutput().toString());
46 assertNotNull(new BeanTaskParameter().toString());
47 assertNotNull(new BeanKeyRef().toString());
48 assertNotNull(new BeanStateTaskRef().toString());
49 assertNotNull(new BeanTask().toString());
51 final BeanState beanState = new BeanState();
52 assertNull(beanState.getName());
53 beanState.setDefaultTask(new BeanKeyRef());
54 assertNotNull(beanState.getDefaultTask());
56 final BeanEvent beanEvent = new BeanEvent();
57 assertNull(beanEvent.get("name"));
59 final BeanFake beanFake = new BeanFake();
60 assertNull(beanFake.get("name"));
61 assertNull(beanFake.get("field1"));
64 beanFake.get("iDontExist");
65 fail("test should throw an exception here");
66 } catch (final IllegalArgumentException e) {
71 fail("test should throw an exception here");
72 } catch (final IllegalArgumentException e) {
76 beanFake.get("field2");
77 fail("test should throw an exception here");
78 } catch (final IllegalArgumentException e) {
82 beanFake.get("field3");
83 fail("test should throw an exception here");
84 } catch (final IllegalArgumentException e) {