diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2019-02-04 16:25:32 +0530 |
---|---|---|
committer | Sandeep J <sandeejh@in.ibm.com> | 2019-02-04 16:25:41 +0530 |
commit | 1e2955570d41d49ce3fa735025dfafa997d56217 (patch) | |
tree | cffbed8c961943e5647d1185e359b0722ef2de52 /appc-adapters | |
parent | 61ebd8f1077c653c93fcf647dbb294aff1c01718 (diff) |
modified existing test case to increase coverage
to increase code coverage
Issue-ID: APPC-1086
Change-Id: Ic028f65e2d62529a91de069050aec11db09b6014
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-adapters')
-rw-r--r-- | appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/RequestFailedExceptionTest.java | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/RequestFailedExceptionTest.java b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/RequestFailedExceptionTest.java index 2ff8d815b..308b98428 100644 --- a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/RequestFailedExceptionTest.java +++ b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/RequestFailedExceptionTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright 2018 TechMahindra *================================================================================= +* Modifications Copyright 2019 IBM. +*================================================================================= * 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 @@ -46,56 +48,59 @@ public class RequestFailedExceptionTest { @Test public void testConstructor_And_GetterSetters() throws Exception { - Server server=new Server(); - HttpStatus status=HttpStatus.ACCEPTED_202; - String reason="Success"; - String operation="POST"; + Server server = new Server(); + HttpStatus status = HttpStatus.ACCEPTED_202; + String reason = "Success"; + String operation = "POST"; RequestFailedException requestFailedException = new RequestFailedException(operation, reason, status, server); requestFailedException.setOperation(operation); requestFailedException.setReason(reason); requestFailedException.setServerId("A"); requestFailedException.setStatus(status); - Assert.assertEquals("POST",requestFailedException.getOperation()); - Assert.assertEquals("Success",requestFailedException.getReason()); - Assert.assertEquals("A",requestFailedException.getServerId()); - Assert.assertEquals( HttpStatus.ACCEPTED_202,requestFailedException.getStatus()); + Assert.assertEquals("POST", requestFailedException.getOperation()); + Assert.assertEquals("Success", requestFailedException.getReason()); + Assert.assertEquals("A", requestFailedException.getServerId()); + Assert.assertEquals(HttpStatus.ACCEPTED_202, requestFailedException.getStatus()); Assert.assertEquals("A", requestFailedException.getServerId()); } @Test public void testConstructorWithFiveArguements() throws Exception { String tMessage = "throwable message"; - Server server=new Server(); - HttpStatus status=HttpStatus.ACCEPTED_202; - String reason="Success"; - String operation="POST"; + Server server = new Server(); + HttpStatus status = HttpStatus.ACCEPTED_202; + String reason = "Success"; + String operation = "POST"; Throwable throwable = new Throwable(tMessage); - RequestFailedException requestFailedException = new RequestFailedException(throwable,operation,reason, status, server); + RequestFailedException requestFailedException = new RequestFailedException(throwable, operation, reason, status, + server); Assert.assertEquals(throwable, requestFailedException.getCause()); - + } @Test public void testConstructorWithFiveArguements_server_Null() throws Exception { String tMessage = "throwable message"; - Server server=null; - HttpStatus status=HttpStatus.ACCEPTED_202; - String reason="Success"; - String operation="POST"; + Server server = null; + HttpStatus status = HttpStatus.ACCEPTED_202; + String reason = "Success"; + String operation = "POST"; Throwable throwable = new Throwable(tMessage); - RequestFailedException requestFailedException = new RequestFailedException(throwable,operation,reason, status, server); + RequestFailedException requestFailedException = new RequestFailedException(throwable, operation, reason, status, + server); Assert.assertEquals(throwable, requestFailedException.getCause()); } @Test public void testConstructorWith_Server_Null() throws Exception { - Server server=null; - HttpStatus status=HttpStatus.ACCEPTED_202; - String reason="Success"; - String operation="POST"; + Server server = new Server(); + server.setId("testId"); + HttpStatus status = HttpStatus.ACCEPTED_202; + String reason = "Success"; + String operation = "POST"; RequestFailedException requestFailedException = new RequestFailedException(operation, reason, status, server); requestFailedException.setServer(server); - Assert.assertEquals(null, requestFailedException.getServer()); + Assert.assertEquals(server, requestFailedException.getServer()); } @Test |