mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 14:50:57 +01:00
Utils: Inline getResourceAsString() into DeterministicKeyChainTest, as it's only being used there.
This commit is contained in:
parent
84048b565b
commit
4daac38758
2 changed files with 7 additions and 12 deletions
|
@ -17,12 +17,10 @@
|
|||
|
||||
package org.bitcoinj.core;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.google.common.io.Resources;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.common.primitives.UnsignedLongs;
|
||||
import org.spongycastle.crypto.digests.RIPEMD160Digest;
|
||||
|
@ -30,7 +28,6 @@ import org.spongycastle.crypto.digests.RIPEMD160Digest;
|
|||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
@ -499,12 +496,4 @@ public class Utils {
|
|||
}
|
||||
return maxItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads and joins together with LF char (\n) all the lines from given file. It's assumed that file is in UTF-8.
|
||||
*/
|
||||
public static String getResourceAsString(URL url) throws IOException {
|
||||
List<String> lines = Resources.readLines(url, Charsets.UTF_8);
|
||||
return Joiner.on('\n').join(lines);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
* Copyright 2018 Andreas Schildbach
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -24,8 +25,12 @@ import org.bitcoinj.utils.BriefLogFormatter;
|
|||
import org.bitcoinj.utils.Threading;
|
||||
import org.bitcoinj.wallet.listeners.AbstractKeyChainEventListener;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.io.Resources;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.spongycastle.crypto.params.KeyParameter;
|
||||
|
@ -522,7 +527,8 @@ public class DeterministicKeyChainTest {
|
|||
private String checkSerialization(List<Protos.Key> keys, String filename) {
|
||||
try {
|
||||
String sb = protoToString(keys);
|
||||
String expected = Utils.getResourceAsString(getClass().getResource(filename));
|
||||
List<String> lines = Resources.readLines(getClass().getResource(filename), Charsets.UTF_8);
|
||||
String expected = Joiner.on('\n').join(lines);
|
||||
assertEquals(expected, sb);
|
||||
return expected;
|
||||
} catch (IOException e) {
|
||||
|
|
Loading…
Add table
Reference in a new issue