Remove use of commons-io
[bgpcep.git] / bgp / cli / src / test / java / org / opendaylight / protocol / bgp / cli / utils / PeerGroupStateCliUtilsTest.java
index a2b67f109b7d35379de6c52c4a6e99420ba98dc9..79230af0c279175af055aa6cf06622f74eb9337f 100644 (file)
@@ -9,11 +9,12 @@ package org.opendaylight.protocol.bgp.cli.utils;
 
 import static org.junit.Assert.assertEquals;
 
+import com.google.common.io.Resources;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
-import org.apache.commons.io.IOUtils;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.peer.group.PeerGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.PeerGroupStateAugmentation;
@@ -22,7 +23,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.open
 public final class PeerGroupStateCliUtilsTest {
 
     private static final String TEST_GROUP = "test-group";
-    static final String UTF8 = "UTF-8";
     private final ByteArrayOutputStream output = new ByteArrayOutputStream();
     private final PrintStream stream = new PrintStream(this.output);
 
@@ -31,8 +31,8 @@ public final class PeerGroupStateCliUtilsTest {
         final PeerGroupBuilder peerGroup = new PeerGroupBuilder().setPeerGroupName(TEST_GROUP);
         PeerGroupStateCliUtils.displayPeerOperationalState(Collections.singletonList(peerGroup.build()), this.stream);
 
-        final String expected = IOUtils.toString(
-                getClass().getClassLoader().getResourceAsStream("empty-peer-group.txt"), UTF8);
+        final String expected = Resources.toString(getClass().getClassLoader().getResource("empty-peer-group.txt"),
+            StandardCharsets.UTF_8);
         assertEquals(expected, this.output.toString());
     }
 
@@ -49,8 +49,8 @@ public final class PeerGroupStateCliUtilsTest {
                 .StateBuilder().addAugmentation(PeerGroupStateAugmentation.class, groupState).build());
         PeerGroupStateCliUtils.displayPeerOperationalState(Collections.singletonList(peerGroup.build()), this.stream);
 
-        final String expected = IOUtils.toString(
-                getClass().getClassLoader().getResourceAsStream("peer-group.txt"), UTF8);
+        final String expected = Resources.toString(getClass().getClassLoader().getResource("peer-group.txt"),
+            StandardCharsets.UTF_8);
         assertEquals(expected, this.output.toString());
     }
 }
\ No newline at end of file