Avoid mocking in tests for EppMetric

Followup to []  Mocking shouldn't be used when you can use the real
implementation just as easily (and more robustly) - in particular, you almost
never want to mock a value type.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132586826
This commit is contained in:
nickfelt 2016-09-08 12:33:00 -07:00 committed by Ben McIlwain
parent e478fd09fb
commit 36c6d59fee
4 changed files with 26 additions and 29 deletions

View file

@ -87,13 +87,12 @@ public class LoginFlowViaConsoleTest extends LoginFlowTestCase {
}
Environment login(final String name, final String authDomain, final String gaeUserId) {
oldEnv = ApiProxy.getCurrentEnvironment();
// This envAttr thing is the only way to set userId.
// see https://code.google.com/p/googleappengine/issues/detail?id=3579
final HashMap<String, Object> envAttr = new HashMap<>();
final HashMap<String, Object> envAttr = new HashMap<>(oldEnv.getAttributes());
envAttr.put("com.google.appengine.api.users.UserService.user_id_key", gaeUserId);
// And then.. this.
oldEnv = ApiProxy.getCurrentEnvironment();
final Environment e = oldEnv;
ApiProxy.setEnvironmentForCurrentThread(new Environment() {
@Override