<commit_before>package org.camunda.bpm.engine.test.assertions.helpers;

import org.assertj.core.api.Assertions;

/**
 * @author <NAME> <<EMAIL>>
 */
public abstract class ProcessAssertTestCase {

  protected void expect(Failure fail) {
    try {
      fail.when();
      throw new RuntimeException();
    } catch (AssertionError e) {
      System.out.println(String.format("caught expected AssertionError with message '%s'", e.getMessage()));
    } catch (RuntimeException e) {
      Assertions.fail("expected an assertion error to be thrown, but did not see any");
    }
  }
  
}<commit_msg>Made checking for AssertionError flexible, in order to potentially check for other exceptions, too.<commit_after>package org.camunda.bpm.engine.test.assertions.helpers;


import org.assertj.core.util.Lists;

import static org.assertj.core.api.Assertions.fail;

/**
 * @author <NAME> <<EMAIL>>
 */
public abstract class ProcessAssertTestCase {

  protected void expect(Failure fail) {
    expect(fail, AssertionError.class);
  }

  protected void expect(Failure fail, Class<? extends Throwable>... exception) {
    try {
      fail.when();
    } catch (Throwable e) {
      for (int i = 0; i< exception.length; i++) {
        Class<? extends Throwable> t = exception[i];
        if (t.isAssignableFrom(e.getClass())) {
          System.out.println(String.format("caught " + e.getClass().getSimpleName() + " of expected type " + t.getSimpleName() + " with message '%s'", e.getMessage()));
          return;
        }
      }
      throw (RuntimeException) e;
    }
    fail("expected on of " + Lists.newArrayList(exception) + " to be thrown, but did not see any");
  }

}
{'fraction_non_alphanumeric': 0.13425647200481639, 'fraction_numerical': 0.0006020469596628537, 'mean_word_length': 3.339425587467363, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5837340', 'n_tokens_mistral': 496, 'n_tokens_neox': 494, 'n_words': 131}