diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2018-10-02 01:58:59 +0530 |
---|---|---|
committer | Sandeep J <sandeejh@in.ibm.com> | 2018-10-02 01:59:17 +0530 |
commit | 1cb3e7a33caebb6bc61a7766c00e30ee6b9f2d3b (patch) | |
tree | 18a28f79d22d1ac9415b919db0ffaf3db41f9af6 | |
parent | 6f094ba9114abf9983bb6de3b365919b88df3af3 (diff) |
added test case to TestFileRecorder
to increase code coverage
Issue-ID: CCSDK-595
Change-Id: Idf00ada3253593a8a5cc2096b927b4bcad457b3c
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
-rw-r--r-- | sli/recording/src/test/java/org/onap/ccsdk/sli/core/sli/recording/TestFileRecorder.java | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/sli/recording/src/test/java/org/onap/ccsdk/sli/core/sli/recording/TestFileRecorder.java b/sli/recording/src/test/java/org/onap/ccsdk/sli/core/sli/recording/TestFileRecorder.java index c879d8f62..d0cc83182 100644 --- a/sli/recording/src/test/java/org/onap/ccsdk/sli/core/sli/recording/TestFileRecorder.java +++ b/sli/recording/src/test/java/org/onap/ccsdk/sli/core/sli/recording/TestFileRecorder.java @@ -3,8 +3,11 @@ */ package org.onap.ccsdk.sli.core.sli.recording; -import static org.junit.Assert.*; +import static org.junit.Assert.fail; + import java.util.HashMap; + +import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -13,23 +16,34 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException; * */ public class TestFileRecorder { + private FileRecorder recorder; + + @Before + public void setUp() { + recorder = new FileRecorder(); + } + + /** + * Test method for + * {@link org.onap.ccsdk.sli.core.sli.recording.FileRecorder#record(java.util.Map)}. + */ + @Test + public void testRecord() { + HashMap<String, String> parms = new HashMap<>(); + parms.put("file", "/dev/null"); + parms.put("field1", "hi"); + try { + recorder.record(parms); + } catch (SvcLogicException e) { + fail("Caught SvcLogicException : " + e.getMessage()); + } + } - /** - * Test method for {@link org.onap.ccsdk.sli.core.sli.recording.FileRecorder#record(java.util.Map)}. - */ - @Test - public void testRecord() { - - FileRecorder recorder = new FileRecorder(); - - HashMap<String,String> parms = new HashMap<>(); - parms.put("file", "/dev/null"); - parms.put("field1","hi"); - try { - recorder.record(parms); - } catch (SvcLogicException e) { - fail("Caught SvcLogicException : "+e.getMessage()); - } - } + @Test(expected = Exception.class) + public void testRecordForEmptyFileName() throws Exception { + HashMap<String, String> parms = new HashMap<>(); + parms.put("field1", "hi"); + recorder.record(parms); + } } |