77import static org .hamcrest .core .Is .is ;
88import static org .junit .jupiter .api .Assertions .assertEquals ;
99
10- import hudson .node_monitors .DiskSpaceMonitorNodeProperty ;
1110import hudson .slaves .EnvironmentVariablesNodeProperty ;
1211import hudson .slaves .NodeProperty ;
1312import hudson .slaves .NodePropertyDescriptor ;
14- import hudson .tools .ToolLocationNodeProperty ;
1513import hudson .util .DescribableList ;
1614import io .jenkins .plugins .casc .misc .ConfiguredWithCode ;
1715import io .jenkins .plugins .casc .misc .JenkinsConfiguredWithCodeRule ;
1816import io .jenkins .plugins .casc .misc .junit .jupiter .WithJenkinsConfiguredWithCode ;
1917import io .jenkins .plugins .casc .model .CNode ;
20- import java .util .Iterator ;
2118import java .util .Map ;
22- import java .util .Map .Entry ;
2319import java .util .Set ;
2420import jenkins .model .Jenkins ;
2521import org .junit .jupiter .api .Test ;
@@ -34,37 +30,14 @@ void configure(JenkinsConfiguredWithCodeRule j) {
3430
3531 DescribableList <NodeProperty <?>, NodePropertyDescriptor > nodeProperties = jenkins .getGlobalNodeProperties ();
3632
37- assertEquals (3 , nodeProperties .size ());
38-
39- Set <Map .Entry <String , String >> envVars = ((EnvironmentVariablesNodeProperty )
40- nodeProperties .get (EnvironmentVariablesNodeProperty .class ))
33+ Set <Map .Entry <String , String >> entries = ((EnvironmentVariablesNodeProperty ) nodeProperties .get (0 ))
4134 .getEnvVars ()
4235 .entrySet ();
43- assertEquals (3 , envVars .size ());
36+ assertEquals (1 , entries .size ());
4437
45- Iterator <Entry <String , String >> iterator = envVars .iterator ();
46- Map .Entry <String , String > envVar = iterator .next ();
38+ Map .Entry <String , String > envVar = entries .iterator ().next ();
4739 assertEquals ("FOO" , envVar .getKey ());
4840 assertEquals ("BAR" , envVar .getValue ());
49-
50- envVar = iterator .next ();
51- assertEquals ("FOO2" , envVar .getKey ());
52- assertEquals ("" , envVar .getValue ());
53-
54- envVar = iterator .next ();
55- assertEquals ("FOO3" , envVar .getKey ());
56- assertEquals ("" , envVar .getValue ());
57-
58- DiskSpaceMonitorNodeProperty diskSpace = nodeProperties .get (DiskSpaceMonitorNodeProperty .class );
59- assertEquals ("1GiB" , diskSpace .getFreeDiskSpaceThreshold ());
60- assertEquals ("2GiB" , diskSpace .getFreeDiskSpaceWarningThreshold ());
61- assertEquals ("1GiB" , diskSpace .getFreeTempSpaceThreshold ());
62- assertEquals ("2GiB" , diskSpace .getFreeTempSpaceWarningThreshold ());
63-
64- ToolLocationNodeProperty toolLocations = nodeProperties .get (ToolLocationNodeProperty .class );
65- assertEquals (1 , toolLocations .getLocations ().size ());
66- assertEquals ("Default" , toolLocations .getLocations ().get (0 ).getName ());
67- assertEquals ("/home/user/bin/git" , toolLocations .getLocations ().get (0 ).getHome ());
6841 }
6942
7043 @ Test
0 commit comments