Skip to content

Commit 311dbf6

Browse files
committed
Evosuite Configured and Tests generated
1 parent ff4e40e commit 311dbf6

143 files changed

Lines changed: 29015 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.evosuite/best-tests/org/apache/commons/cli/CommandLine_ESTest.java

Lines changed: 2250 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/**
2+
* Scaffolding file used to store all the setups needed to run
3+
* tests automatically generated by EvoSuite
4+
* Sat Mar 21 17:27:02 GMT 2026
5+
*/
6+
7+
package org.apache.commons.cli;
8+
9+
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
10+
import org.junit.BeforeClass;
11+
import org.junit.Before;
12+
import org.junit.After;
13+
import org.junit.AfterClass;
14+
import org.evosuite.runtime.sandbox.Sandbox;
15+
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
16+
17+
import static org.evosuite.shaded.org.mockito.Mockito.*;
18+
@EvoSuiteClassExclude
19+
public class CommandLine_ESTest_scaffolding {
20+
21+
@org.junit.Rule
22+
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
23+
24+
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
25+
26+
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
27+
28+
29+
@BeforeClass
30+
public static void initEvoSuiteFramework() {
31+
org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.cli.CommandLine";
32+
org.evosuite.runtime.GuiSupport.initialize();
33+
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
34+
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
35+
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
36+
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
37+
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
38+
org.evosuite.runtime.classhandling.JDKClassResetter.init();
39+
setSystemProperties();
40+
initializeClasses();
41+
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
42+
try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {}
43+
}
44+
45+
@AfterClass
46+
public static void clearEvoSuiteFramework(){
47+
Sandbox.resetDefaultSecurityManager();
48+
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
49+
}
50+
51+
@Before
52+
public void initTestCase(){
53+
threadStopper.storeCurrentThreads();
54+
threadStopper.startRecordingTime();
55+
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
56+
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
57+
setSystemProperties();
58+
org.evosuite.runtime.GuiSupport.setHeadless();
59+
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
60+
org.evosuite.runtime.agent.InstrumentingAgent.activate();
61+
}
62+
63+
@After
64+
public void doneWithTestCase(){
65+
threadStopper.killAndJoinClientThreads();
66+
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
67+
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
68+
resetClasses();
69+
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
70+
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
71+
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
72+
}
73+
74+
public static void setSystemProperties() {
75+
76+
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
77+
java.lang.System.setProperty("file.encoding", "Cp1252");
78+
java.lang.System.setProperty("java.awt.headless", "true");
79+
java.lang.System.setProperty("java.io.tmpdir", "C:\\Users\\RAJEND~1\\AppData\\Local\\Temp\\");
80+
java.lang.System.setProperty("user.country", "IN");
81+
java.lang.System.setProperty("user.dir", "C:\\Users\\RAJENDRA BRAHNBHATT\\Desktop\\University\\Winter 2026\\EECS4313\\Assignment 2\\commons-cli");
82+
java.lang.System.setProperty("user.home", "C:\\Users\\RAJENDRA BRAHNBHATT");
83+
java.lang.System.setProperty("user.language", "en");
84+
java.lang.System.setProperty("user.name", "RAJENDRA BRAHNBHATT");
85+
java.lang.System.setProperty("user.timezone", "America/New_York");
86+
}
87+
88+
private static void initializeClasses() {
89+
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(CommandLine_ESTest_scaffolding.class.getClassLoader() ,
90+
"org.apache.commons.cli.DeprecatedAttributes",
91+
"org.apache.commons.text.Builder",
92+
"org.apache.commons.text.StringTokenizer",
93+
"org.apache.commons.text.TextStringBuilder$TextStringBuilderReader",
94+
"org.apache.commons.text.TextStringBuilder",
95+
"org.apache.commons.cli.DeprecatedAttributes$Builder",
96+
"org.apache.commons.cli.Option$Builder",
97+
"org.apache.commons.text.matcher.StringMatcher",
98+
"org.apache.commons.lang3.StringUtils",
99+
"org.apache.commons.cli.TypeHandler",
100+
"org.apache.commons.text.TextStringBuilder$TextStringBuilderTokenizer",
101+
"org.apache.commons.text.TextStringBuilder$TextStringBuilderWriter",
102+
"org.apache.commons.cli.Converter",
103+
"org.apache.commons.cli.CommandLine$Builder",
104+
"org.apache.commons.cli.AlreadySelectedException",
105+
"org.apache.commons.cli.ParseException",
106+
"org.apache.commons.text.similarity.LongestCommonSubsequence",
107+
"org.apache.commons.cli.OptionValidator",
108+
"org.apache.commons.cli.OptionGroup",
109+
"org.apache.commons.cli.CommandLine",
110+
"org.apache.commons.text.similarity.SimilarityScore",
111+
"org.apache.commons.text.similarity.ObjectSimilarityScore",
112+
"org.apache.commons.cli.Option",
113+
"org.apache.commons.cli.Util"
114+
);
115+
}
116+
private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException {
117+
mock(Class.forName("java.util.function.Supplier", false, CommandLine_ESTest_scaffolding.class.getClassLoader()));
118+
mock(Class.forName("org.apache.commons.text.matcher.StringMatcher", false, CommandLine_ESTest_scaffolding.class.getClassLoader()));
119+
}
120+
121+
private static void resetClasses() {
122+
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(CommandLine_ESTest_scaffolding.class.getClassLoader());
123+
124+
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
125+
"org.apache.commons.cli.CommandLine",
126+
"org.apache.commons.cli.CommandLine$Builder",
127+
"org.apache.commons.cli.Util",
128+
"org.apache.commons.cli.Option",
129+
"org.apache.commons.cli.OptionValidator",
130+
"org.apache.commons.cli.OptionGroup",
131+
"org.apache.commons.cli.Option$Builder",
132+
"org.apache.commons.text.TextStringBuilder",
133+
"org.apache.commons.cli.DeprecatedAttributes",
134+
"org.apache.commons.cli.DeprecatedAttributes$Builder",
135+
"org.apache.commons.lang3.StringUtils",
136+
"org.apache.commons.cli.Converter",
137+
"org.apache.commons.cli.TypeHandler",
138+
"org.apache.commons.text.similarity.LongestCommonSubsequence",
139+
"org.apache.commons.cli.ParseException",
140+
"org.apache.commons.text.similarity.LongestCommonSubsequenceDistance",
141+
"org.apache.commons.io.filefilter.IOFileFilter",
142+
"org.apache.commons.text.similarity.HammingDistance",
143+
"org.apache.commons.text.similarity.SimilarityCharacterInput",
144+
"org.apache.commons.text.TextStringBuilder$TextStringBuilderReader",
145+
"org.apache.commons.text.TextStringBuilder$TextStringBuilderWriter",
146+
"org.apache.commons.text.matcher.AbstractStringMatcher",
147+
"org.apache.commons.text.matcher.AbstractStringMatcher$CharMatcher",
148+
"org.apache.commons.text.matcher.AbstractStringMatcher$NoneMatcher",
149+
"org.apache.commons.text.matcher.AbstractStringMatcher$CharSetMatcher",
150+
"org.apache.commons.text.matcher.AbstractStringMatcher$TrimMatcher",
151+
"org.apache.commons.text.matcher.StringMatcherFactory",
152+
"org.apache.commons.text.StringTokenizer",
153+
"org.apache.commons.text.TextStringBuilder$TextStringBuilderTokenizer"
154+
);
155+
}
156+
}

0 commit comments

Comments
 (0)