@Test
  public void testSmallDecodingsAndFailures() {
    // decoded, but not enough to return any bytes.
    assertThat(checkDecoding("A")).hasLength(0);
    assertThat(checkDecoding("")).hasLength(0);
    assertThat(checkDecoding(" ")).hasLength(0);

    // decoded successfully and returned 1 byte.
    assertThat(checkDecoding("AA")).hasLength(1);
    assertThat(checkDecoding("AAA")).hasLength(1);

    // decoded successfully and returned 2 bytes.
    assertThat(checkDecoding("AAAA")).hasLength(2);

    // acceptable separators " " and "-" which should be ignored
    assertThat(checkDecoding("AA-AA")).hasLength(2);
    assertThat(checkDecoding("AA-AA")).hasLength(2);
    assertThat(checkDecoding("AA AA")).isEqualTo(checkDecoding("AA-AA"));
    assertThat(checkDecoding("AA AA")).isEqualTo(checkDecoding("AAAA"));

    // 1, 8, 9, 0 are not a valid character, decoding should fail
    assertThat(checkDecoding("11")).isNull();
    assertThat(checkDecoding("A1")).isNull();
    assertThat(checkDecoding("AAA8")).isNull();
    assertThat(checkDecoding("AAA9")).isNull();
    assertThat(checkDecoding("AAA0")).isNull();

    // non-alphanumerics (except =) are not valid characters and decoding should fail
    assertThat(checkDecoding("AAA,")).isNull();
    assertThat(checkDecoding("AAA;")).isNull();
    assertThat(checkDecoding("AAA.")).isNull();
    assertThat(checkDecoding("AAA!")).isNull();

    // this just documents that a null string causes a nullpointerexception.
    try {
      checkDecoding(null);
      Assert.fail();
    } catch (NullPointerException e) {
      // expected.
    }
  }
Base32String implementation is not the same as that of RFC 4648, it drops
the last incomplete chunk and thus accepts encoded strings that should have
been rejected; also this results in multiple encoded strings being decoded
to the same byte array.
This test will catch any changes made regarding this behavior.
javatests/com/google/android/apps/authenticator/util/Base32StringTest.java