@@ -0,0 +1,1866 @@
+package com.suse.saltstack.netapi.utils;%0A%0Aimport org.junit.Test;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.util.Scanner;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * SaltStackClientUtils class unit-tests.%0A */%0Apublic class SaltStackClientUtilsTest %7B%0A%0A    @Test%0A    public void testCloseQuietly() throws IOException %7B%0A        // Mocked InputStream that throws IOException when closed more than once.%0A        InputStream is = new InputStream() %7B%0A            private boolean closed = false;%0A%0A            @Override%0A            public int read() throws IOException %7B%0A                return 0;%0A            %7D%0A%0A            @Override%0A            public void close() throws IOException %7B%0A                if (closed) %7B%0A                    throw new IOException(%22Stream already closed%22);%0A                %7D%0A                closed = true;%0A            %7D%0A        %7D;%0A%0A        // Close valid stream%0A        SaltStackClientUtils.closeQuietly(is);%0A%0A        // Close already closed stream, don't throw exception%0A        SaltStackClientUtils.closeQuietly(is);%0A%0A        // Close null stream, don't throw exception%0A        SaltStackClientUtils.closeQuietly(null);%0A    %7D%0A%0A    @Test%0A    public void testStringToStream() %7B%0A        final String TEST_STRING = %22SUSE%22;%0A        InputStream is = SaltStackClientUtils.stringToStream(TEST_STRING);%0A        Scanner scanner = new Scanner(is);%0A        String result = scanner.nextLine();%0A        assertEquals(%22Result doesn't match test string%22, result, TEST_STRING);%0A    %7D%0A%0A    @Test%0A    public void testStreamToString() %7B%0A        final String TEST_STRING = %22SUSE%22;%0A        String result = SaltStackClientUtils.streamToString(%0A                new ByteArrayInputStream(TEST_STRING.getBytes()));%0A        assertEquals(%22Result doesn't match test string%22, result, TEST_STRING);%0A    %7D%0A%7D%0A

Add testcases for SaltStackClientUtils class