JUnit 4.13.2 Source Code Files

JUnit Source Code Files are provided in the source package file, junit-4.13.2-sources.jar.

You can browse JUnit Source Code files below:

✍: FYIcenter.com

org/junit/internal/management/ReflectiveRuntimeMXBean.java

package org.junit.internal.management;

import org.junit.internal.Classes;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;

/**
 * Implementation of {@link RuntimeMXBean} using the JVM reflectively.
 */
final class ReflectiveRuntimeMXBean implements RuntimeMXBean {
  private final Object runtimeMxBean;

  private static final class Holder {
    private static final Method getInputArgumentsMethod;
    static {
      Method inputArguments = null;
      try {
        Class<?> threadMXBeanClass = Classes.getClass("java.lang.management.RuntimeMXBean");
        inputArguments = threadMXBeanClass.getMethod("getInputArguments");
      } catch (ClassNotFoundException e) {
        // do nothing, input arguments will be null on failure
      } catch (NoSuchMethodException e) {
        // do nothing, input arguments will be null on failure
      } catch (SecurityException e) {
        // do nothing, input arguments will be null on failure
      }
      getInputArgumentsMethod = inputArguments;
    }
  }

  ReflectiveRuntimeMXBean(Object runtimeMxBean) {
    super();
    this.runtimeMxBean = runtimeMxBean;
  }

  /**
   * {@inheritDoc}
   */
  @SuppressWarnings("unchecked")
  public List<String> getInputArguments() {
    if (Holder.getInputArgumentsMethod != null) {
      try {
        return (List<String>) Holder.getInputArgumentsMethod.invoke(runtimeMxBean);
      } catch (ClassCastException e) { // no multi-catch with source level 6
        // fallthrough
      } catch (IllegalAccessException e) {
        // fallthrough
      } catch (IllegalArgumentException e) {
        // fallthrough
      } catch (InvocationTargetException e) {
        // fallthrough
      }
    }
    return Collections.emptyList();
  }

}

org/junit/internal/management/ReflectiveRuntimeMXBean.java

 

Or download all of them as a single archive file:

File name: junit-4.13.2-sources.jar
File size: 234540 bytes
Release date: 2021-02-13
Download 

 

Download and Install junit-4.12.jar

Download and Install junit-4.13.2.jar

Download and Install JUnit (Java Unit) Testing

⇑⇑ FAQ for JUnit (Java Unit) Testing

2016-03-28, 11005👍, 0💬