@@ -0,0 +1,2219 @@
+/*%0A * Copyright 2016 Peter Kenji Yamanaka%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.pyamsoft.padlock.dagger.lock;%0A%0Aimport com.pyamsoft.padlock.BuildConfig;%0Aimport com.pyamsoft.padlock.TestPadLock;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.robolectric.RobolectricTestRunner;%0Aimport org.robolectric.annotation.Config;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertNotEquals;%0Aimport static org.junit.Assert.assertTrue;%0A%0A@RunWith(RobolectricTestRunner.class)%0A@Config(application = TestPadLock.class, sdk = 23, constants = BuildConfig.class)%0Apublic class LockInteractorTest %7B%0A%0A  LockInteractor interactor;%0A%0A  @Before public void setup() %7B%0A    interactor = new LockInteractorImpl() %7B%0A    %7D;%0A  %7D%0A%0A  /**%0A   * Test that the same string encoded twice produces the same result%0A   * @throws Exception%0A   */%0A  @Test public void testEncodeIndentity() throws Exception %7B%0A    final String encoded = interactor.encodeSHA256(%22TEST 1%22).toBlocking().first();%0A    assertEquals(encoded, interactor.encodeSHA256(%22TEST 1%22).toBlocking().first());%0A    assertTrue(interactor.checkSubmissionAttempt(%22TEST 1%22, encoded).toBlocking().first());%0A  %7D%0A%0A  /**%0A   * Test that two different strings produces different results%0A   * @throws Exception%0A   */%0A  @Test public void testEncodeCorrectness() throws Exception %7B%0A    final String encoded = interactor.encodeSHA256(%22TEST 1%22).toBlocking().first();%0A    assertNotEquals(encoded, interactor.encodeSHA256(%22RANDOM%22).toBlocking().first());%0A    assertFalse(interactor.checkSubmissionAttempt(%22ANOTHER RANDOM%22, encoded).toBlocking().first());%0A  %7D%0A%7D%0A

Add test for lock interactor