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;
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);
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());
}
.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