diff options
author | Benjamin Wulfe <benwu@google.com> | 2014-12-08 10:35:36 -0500 |
---|---|---|
committer | Benjamin Wulfe <benwu@google.com> | 2014-12-12 20:44:02 +0000 |
commit | dc8ca50a2476c17880b7ed66836487ded42b83a5 (patch) | |
tree | fec94c035ba19eb2841465e7c7018fa95f6fa038 /testSrc | |
parent | 9d5ed765f14e232ac4cb7e26f0caa5fb6e850db7 (diff) | |
download | login-dc8ca50a2476c17880b7ed66836487ded42b83a5.tar.gz |
Adds support for unit tests.
Change-Id: I8bf64d67bb3c3bae240c478c0e45ad5d5110fd88
Diffstat (limited to 'testSrc')
-rw-r--r-- | testSrc/com/google/gct/login/MockGoogleLogin.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/testSrc/com/google/gct/login/MockGoogleLogin.java b/testSrc/com/google/gct/login/MockGoogleLogin.java new file mode 100644 index 0000000..d17652c --- /dev/null +++ b/testSrc/com/google/gct/login/MockGoogleLogin.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.gct.login; + +import org.mockito.Mockito; + +import java.io.*; + +/** + * Helper to install a mock googleLogin + */ +public class MockGoogleLogin { + GoogleLogin myGoogleLogin; + + public void install() { + myGoogleLogin = GoogleLogin.getInstance(); + GoogleLogin.setInstance(Mockito.mock(GoogleLogin.class)); + } + + public void cleanup() { + GoogleLogin.setInstance(myGoogleLogin); + } +} |