mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 19:25:51 +00:00
Utils: Inline getResourceAsString() into DeterministicKeyChainTest, as it's only being used there.
This commit is contained in:
parent
84048b565b
commit
4daac38758
@ -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…
x
Reference in New Issue
Block a user