Esempio n. 1
0
  private void resetClassFields(final Class<?> aClass) {
    try {
      UsefulTestCase.clearDeclaredFields(this, aClass);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    }

    if (aClass == LightPlatformTestCase.class) return;
    resetClassFields(aClass.getSuperclass());
  }
Esempio n. 2
0
  private List<String> collectModuleDepsNames(String moduleName, Class clazz) {
    List<String> actual = new ArrayList<String>();

    for (OrderEntry e : getRootManager(moduleName).getOrderEntries()) {
      if (clazz.isInstance(e)) {
        actual.add(e.getPresentableName());
      }
    }
    return actual;
  }
 private static int rearrangeOrderEntryOfType(
     ModifiableRootModel rootModel, Class<? extends OrderEntry> orderEntryClass) {
   OrderEntry[] orderEntries = rootModel.getOrderEntries();
   int moduleSourcesIdx = 0;
   for (OrderEntry orderEntry : orderEntries) {
     if (orderEntryClass.isAssignableFrom(orderEntry.getClass())) {
       break;
     }
     moduleSourcesIdx++;
   }
   orderEntries = ArrayUtil.append(orderEntries, orderEntries[moduleSourcesIdx]);
   orderEntries = ArrayUtil.remove(orderEntries, moduleSourcesIdx);
   rootModel.rearrangeOrderEntries(orderEntries);
   return orderEntries.length - 1;
 }
Esempio n. 4
0
  private <T> T getModuleDep(String moduleName, String depName, Class<T> clazz) {
    T dep = null;

    for (OrderEntry e : getRootManager(moduleName).getOrderEntries()) {
      if (clazz.isInstance(e) && e.getPresentableName().equals(depName)) {
        dep = (T) e;
      }
    }
    assertNotNull(
        "Dependency not found: "
            + depName
            + "\namong: "
            + collectModuleDepsNames(moduleName, clazz),
        dep);
    return dep;
  }