Remove the use of InjectRule in UrlFetchUtilsTest

Random used to be a static variable which requires InjectRule to mock it in unit tests. It is now a singleton, which ensures that the same instance is called every time and Random.nextBytes() generates results that distribute uniformly between each call.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217592767
This commit is contained in:
jianglai
2018-10-22 18:44:56 -04:00
parent 84c3544097
commit 4140ef6315
5 changed files with 35 additions and 12 deletions
@@ -14,6 +14,7 @@
package google.registry.tmch;
import static com.google.common.base.Randoms.insecureRandom;
import static com.google.common.net.HttpHeaders.AUTHORIZATION;
import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
import static com.google.common.net.HttpHeaders.LOCATION;
@@ -115,6 +116,7 @@ public class NordnUploadActionTest {
action.taskQueueUtils = new TaskQueueUtils(new Retrier(new FakeSleeper(clock), 3));
action.tld = "tld";
action.tmchMarksdbUrl = "http://127.0.0.1";
action.random = insecureRandom();
}
@Test