Ejemplo n.º 1
0
  @Test
  public void testIsEncrypted() throws Exception {

    assertEquals(databaseControl.isEncrypted(), false);

    Password newPassword = new Password("NewPassword".getBytes());
    databaseControl.setPassword(password, newPassword);

    assertEquals(databaseControl.isEncrypted(), true);
  }
Ejemplo n.º 2
0
  @Test
  public void testSetPassword() throws Exception {

    Password newPassword = new Password("NewPassword".getBytes());

    assertEquals(databaseControl.isEncrypted(), false);
    databaseControl.setPassword(null, password);
    assertEquals(databaseControl.isEncrypted(), true);

    Item item = new Item("link", "user", "pass");
    databaseControl.addItem(item, password);

    databaseControl.setPassword(password, newPassword);

    Item item1 = new Item("link1", "user1", "pass1");
    databaseControl.addItem(item1, newPassword);

    try {
      Item item2 = new Item("link2", "user2", "pass2");
      databaseControl.addItem(item2, password);
      fail("Didn't trigger InvalidPasswordException!");
    } catch (InvalidPasswordException ipe) {
    }
  }