* ============LICENSE_START=======================================================
* policy-yaml unit test
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 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.
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
-
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ControlLoopGuardTest {
private static final Logger logger = LoggerFactory.getLogger(ControlLoopGuardTest.class);
-
- @Test
- public void testGuardvdns() {
+
+ @Test
+ public void testGuardvdns() throws Exception {
this.test("src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml");
}
- @Test
- public void testGuardvusp() {
+ @Test
+ public void testGuardvusp() throws Exception {
this.test("src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml");
}
/**
* Does the actual test.
- *
+ *
* @param testFile input file
+ * @throws Exception if an error occurs
*/
- public void test(String testFile) {
+ public void test(String testFile) throws Exception {
try (InputStream is = new FileInputStream(new File(testFile))) {
//
// Read the yaml into our Java Object
dump(newObject);
assertNotNull(newObject);
assertTrue(newObject instanceof ControlLoopGuard);
- //
- // Have to comment it out tentatively since it causes junit to fail.
- // Seems we cannot use assertEquals here. Need advice.
- //
- //assertEquals(newObject, obj);
- } catch (FileNotFoundException e) {
- fail(e.getLocalizedMessage());
- } catch (IOException e) {
- fail(e.getLocalizedMessage());
+
+ assertEquals(obj, newObject);
}
}