diff options
author | waynedunican <wayne.dunican@est.tech> | 2020-07-07 17:51:42 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2020-07-17 09:44:03 +0100 |
commit | 4752a9ede61f2df4e67ec18f6c53cdcd0c35885f (patch) | |
tree | 29374ab930d63747cd9fff119d598184930a056d /auth/cli-codegen/src/test/java/org | |
parent | 28eced32d2acdf731f7782e14f37bf2ea8c98019 (diff) |
Replace try/catch with assertj - apex-pdp
Replaced try/catch blocks in apex-pdp with assertj assertions. Part II
of changes
Issue-ID: POLICY-2451
Change-Id: I29823054fbeb6d1a287d1234859aaf2d4609ef6d
Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'auth/cli-codegen/src/test/java/org')
-rw-r--r-- | auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditorTest.java | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditorTest.java b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditorTest.java index 83aef2d07..921591b32 100644 --- a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditorTest.java +++ b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditorTest.java @@ -2,19 +2,20 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. + * Modifications Copyright (C) 2020 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file 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. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -22,11 +23,9 @@ package org.onap.policy.apex.auth.clicodegen; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; @@ -65,32 +64,25 @@ public class CodeGeneratorCliEditorTest { private File outFile = null; @Test - public void test() throws IOException { + public void test() throws IOException, ApexModelException { final CodeGeneratorCliEditor codeGen = new CodeGeneratorCliEditor(); outFile = File.createTempFile("ApexTestGenerated", ".apex"); ApexModelReader<AxPolicyModel> modelReader = null; - try { - modelReader = new ApexModelReader<>(AxPolicyModel.class); - } catch (ApexModelException e1) { - fail("test should not throw an exception"); - } + modelReader = new ApexModelReader<>(AxPolicyModel.class); + modelReader.setValidateFlag(false); AxPolicyModel apexPolicyModel = null; - try { - apexPolicyModel = modelReader + apexPolicyModel = modelReader .read(new FileInputStream(new File("src/test/resources/models/TestPolicyModel.json"))); - } catch (ApexModelException | FileNotFoundException e) { - fail("test should not throw an exception"); - } assertEquals(0, generateCli(codeGen, apexPolicyModel)); } /** * Generate the CLI from the model. - * + * * @param codeGen the code generator * @param policyModel the policy model * @throws IOException on generation exceptions |