Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
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/MethodSorter.java
package org.junit.internal; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Comparator; import org.junit.FixMethodOrder; public class MethodSorter { /** * DEFAULT sort order */ public static final Comparator<Method> DEFAULT = new Comparator<Method>() { public int compare(Method m1, Method m2) { int i1 = m1.getName().hashCode(); int i2 = m2.getName().hashCode(); if (i1 != i2) { return i1 < i2 ? -1 : 1; } return NAME_ASCENDING.compare(m1, m2); } }; /** * Method name ascending lexicographic sort order, with {@link Method#toString()} as a tiebreaker */ public static final Comparator<Method> NAME_ASCENDING = new Comparator<Method>() { public int compare(Method m1, Method m2) { final int comparison = m1.getName().compareTo(m2.getName()); if (comparison != 0) { return comparison; } return m1.toString().compareTo(m2.toString()); } }; /** * Gets declared methods of a class in a predictable order, unless @FixMethodOrder(MethodSorters.JVM) is specified. * * Using the JVM order is unwise since the Java platform does not * specify any particular order, and in fact JDK 7 returns a more or less * random order; well-written test code would not assume any order, but some * does, and a predictable failure is better than a random failure on * certain platforms. By default, uses an unspecified but deterministic order. * * @param clazz a class * @return same as {@link Class#getDeclaredMethods} but sorted * @see <a href="http://bugs.sun.com/view_bug.do?bug_id=7023180">JDK * (non-)bug #7023180</a> */ public static Method[] getDeclaredMethods(Class<?> clazz) { Comparator<Method> comparator = getSorter(clazz.getAnnotation(FixMethodOrder.class)); Method[] methods = clazz.getDeclaredMethods(); if (comparator != null) { Arrays.sort(methods, comparator); } return methods; } private MethodSorter() { } private static Comparator<Method> getSorter(FixMethodOrder fixMethodOrder) { if (fixMethodOrder == null) { return DEFAULT; } return fixMethodOrder.value().getComparator(); } }
⏎ org/junit/internal/MethodSorter.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
2016-03-28, 11113👍, 0💬
Popular Posts:
JDK 11 java.naming.jmod is the JMOD file for JDK 11 Naming module. JDK 11 Naming module compiled cla...
What Is jniwrap.jar in JNIWrapper 3.7.1? winpack.jar in JNIWrapper 3.7.1 is an add-on JAR file for J...
JDK 11 java.compiler.jmod is the JMOD file for JDK 11 Compiler module. JDK 11 Compiler module compil...
How to download and install JDK (Java Development Kit) 6? If you want to write Java applications, yo...
JDK 11 java.naming.jmod is the JMOD file for JDK 11 Naming module. JDK 11 Naming module compiled cla...