Esempio n. 1
0
  @Test
  public void Initialize_RegistryProperlySet_MethodSuccesfullyInvoked() throws Exception {
    when(mockPluginDatabaseSystem.openDatabase(
            testId, IncomingExtraUserDataBaseConstants.INCOMING_EXTRA_USER_DATABASE))
        .thenReturn(mockDatabase);

    testRegistry = new IncomingExtraUserRegistry();
    testRegistry.setErrorManager(mockErrorManager);
    testRegistry.setPluginDatabaseSystem(mockPluginDatabaseSystem);
    catchException(testRegistry).initialize(testId);
    assertThat(caughtException()).isNull();
  }
Esempio n. 2
0
 @Test
 public void Initialize_CantOpenDatabase_ThrowsCantInitializeCryptoRegistryException()
     throws Exception {
   when(mockPluginDatabaseSystem.openDatabase(
           testId, IncomingExtraUserDataBaseConstants.INCOMING_EXTRA_USER_DATABASE))
       .thenThrow(new CantOpenDatabaseException("MOCK", null, null, null));
   testRegistry = new IncomingExtraUserRegistry();
   testRegistry.setErrorManager(mockErrorManager);
   testRegistry.setPluginDatabaseSystem(mockPluginDatabaseSystem);
   catchException(testRegistry).initialize(testId);
   assertThat(caughtException()).isInstanceOf(CantInitializeCryptoRegistryException.class);
 }
Esempio n. 3
0
 @Test
 public void Initialize_NoPluginDatabaseSystemSet_ThrowsCantInitializeCryptoRegistryException()
     throws Exception {
   testRegistry = new IncomingExtraUserRegistry();
   testRegistry.setErrorManager(mockErrorManager);
   catchException(testRegistry).initialize(testId);
   assertThat(caughtException()).isInstanceOf(CantInitializeCryptoRegistryException.class);
 }
Esempio n. 4
0
 @Test
 public void Initialize_DatabaseNotFound_MethodSuccesfullyInvoked() throws Exception {
   when(mockPluginDatabaseSystem.openDatabase(
           testId, IncomingExtraUserDataBaseConstants.INCOMING_EXTRA_USER_DATABASE))
       .thenThrow(
           new DatabaseNotFoundException(
               DatabaseNotFoundException.DEFAULT_MESSAGE, null, null, null));
   when(mockPluginDatabaseSystem.createDatabase(
           testId, IncomingExtraUserDataBaseConstants.INCOMING_EXTRA_USER_DATABASE))
       .thenReturn(mockDatabase);
   when(mockDatabase.getDatabaseFactory()).thenReturn(mockDatabaseFactory);
   when(mockDatabaseFactory.newTableFactory(any(UUID.class), anyString()))
       .thenReturn(mockTableFactory);
   testRegistry = new IncomingExtraUserRegistry();
   testRegistry.setErrorManager(mockErrorManager);
   testRegistry.setPluginDatabaseSystem(mockPluginDatabaseSystem);
   catchException(testRegistry).initialize(testId);
   assertThat(caughtException()).isNull();
 }