@SuppressWarnings({"ThrowableInstanceNeverThrown"})
  private void expectEvaluateCalled(
      final I_EncodeBusinessProcess mockBusinessProcess,
      final CleanableProcessExtByRef mockCleanableProcess,
      final CleanableProcessExtByRefBuilder mockCleanableProcessBuilder)
      throws Exception {

    File mockDirectoryFile = mockControl.createMock(File.class);
    I_GetConceptData mockRefset = mockControl.createMock(I_GetConceptData.class);

    EasyMock.expect(mockTerminologyWrapper.get()).andReturn(mockTermFactory);
    EasyMock.expect(mockBusinessProcess.getProperty(DIRECTORY_KEY)).andReturn(mockDirectoryFile);
    EasyMock.expect(mockBusinessProcess.getProperty(WORKING_REFSET_KEY)).andReturn(mockRefset);
    mockPropertyValidator.validate(mockDirectoryFile, "output directory");
    mockPropertyValidator.validate(mockRefset, "selected refset");

    EasyMock.expect(mockCleanableProcessBuilder.withTermFactory(mockTermFactory))
        .andReturn(mockCleanableProcessBuilder);
    EasyMock.expect(mockCleanableProcessBuilder.withSelectedDir(mockDirectoryFile))
        .andReturn(mockCleanableProcessBuilder);
    EasyMock.expect(mockCleanableProcessBuilder.withLogger(EasyMock.isA(Logger.class)))
        .andReturn(mockCleanableProcessBuilder);
    EasyMock.expect(mockCleanableProcessBuilder.build()).andReturn(mockCleanableProcess);
    I_ExtendByRef mockExt1 = mockControl.createMock(I_ExtendByRef.class);
    I_ExtendByRef mockExt2 = mockControl.createMock(I_ExtendByRef.class);
    EasyMock.expect(mockRefset.getConceptId()).andReturn(REFSET_CONCEPT_ID);
    // TODO fix this one
    // EasyMock.expect(mockTermFactory.getRefsetExtensionMembers(REFSET_CONCEPT_ID)).andReturn(Arrays.asList(mockExt1, mockExt2));

    mockCleanableProcess.processExtensionByReference(mockExt1);
    mockCleanableProcess.processExtensionByReference(mockExt2);
    EasyMock.expectLastCall().andThrow(new IllegalStateException());

    mockCleanableProcess.clean();
  }
예제 #2
0
 protected static Properties validatedProperties(PropertyValidator propertyValidator) {
   final String path = propertiesPath();
   final Properties properties = propertiesFromFile(path);
   propertyValidator.validate(properties, path);
   return properties;
 }