Skip to content

Commit 86a3850

Browse files
The additional commit to #147.
A bug was found and now it is fixed.
1 parent 6b91363 commit 86a3850

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,12 @@ protected ImmutableList<String> createArgs() {
231231
Map.Entry<String, String> entry = iterator.next();
232232
String argument = entry.getKey();
233233
String value = entry.getValue();
234-
if (StringUtils.isBlank(argument) || StringUtils.isBlank(value))
234+
if (StringUtils.isBlank(argument) || value == null)
235235
continue;
236236

237237
argList.add(argument);
238-
argList.add(value);
238+
if (!StringUtils.isBlank(value))
239+
argList.add(value);
239240
}
240241

241242
ImmutableList<String> result = new ImmutableList.Builder<String>().addAll(argList).build();

src/test/java/io/appium/java_client/localserver/ServerBuilderTest.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void checkAbilityToBuildServiceWithDefinedParametersAndNodeSetInPropertie
4747
String definedNode = findCustomNode().getAbsolutePath();
4848
System.setProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY, definedNode);
4949
AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1").
50-
usingPort(4000).withArgument(GeneralServerFlag.LOG_TIMESTAMP,""));
50+
usingPort(4000).withArgument(GeneralServerFlag.SESSION_OVERRIDE,""));
5151
}
5252
finally {
5353
System.clearProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY);
@@ -60,7 +60,7 @@ public void checkAbilityToStartServiceOnAFreePort(){
6060
String definedNode = findCustomNode().getAbsolutePath();
6161
System.setProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY, definedNode);
6262
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1").
63-
usingAnyFreePort().withArgument(GeneralServerFlag.LOG_TIMESTAMP));
63+
usingAnyFreePort().withArgument(GeneralServerFlag.SESSION_OVERRIDE));
6464
service.start();
6565
assertEquals(true, service.isRunning());
6666
service.stop();
@@ -74,7 +74,7 @@ public void checkAbilityToStartServiceOnAFreePort(){
7474
public void checkAbilityToBuildServiceWithDefinedParametersAndExternallyDefinedNode(){
7575
File definedNode = findCustomNode();
7676
AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withAppiumJS(definedNode).withIPAddress("127.0.0.1").
77-
usingPort(4000).withArgument(GeneralServerFlag.LOG_TIMESTAMP,""));
77+
usingPort(4000).withArgument(GeneralServerFlag.SESSION_OVERRIDE,""));
7878
}
7979

8080
@Test
@@ -85,13 +85,22 @@ public void checkStartingOfDefaultService(){
8585
service.stop();
8686
}
8787

88+
@Test
89+
public void checkStartingOfDefaultServiceWithNonDefaultArguments(){
90+
AppiumDriverLocalService service = new AppiumServiceBuilder().
91+
withArgument(GeneralServerFlag.LOG_NO_COLORS).withIPAddress("127.0.0.1").build();
92+
service.start();
93+
assertEquals(true, service.isRunning());
94+
service.stop();
95+
}
96+
8897
@Test
8998
public void checkStartingOfTheServiceDefinedByProperty(){
9099
try {
91100
String definedNode = findCustomNode().getAbsolutePath();
92101
System.setProperty(AppiumServiceBuilder.APPIUM_NODE_PROPERTY, definedNode);
93102
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1").
94-
usingPort(4000).withArgument(GeneralServerFlag.LOG_TIMESTAMP));
103+
usingPort(4000).withArgument(GeneralServerFlag.SESSION_OVERRIDE));
95104
service.start();
96105
assertEquals(true, service.isRunning());
97106
service.stop();
@@ -105,7 +114,7 @@ public void checkStartingOfTheServiceDefinedByProperty(){
105114
public void checkStartingOfTheServiceDefinedExternally(){
106115
File definedNode = findCustomNode();
107116
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withAppiumJS(definedNode).withIPAddress("127.0.0.1").
108-
usingPort(4000).withArgument(GeneralServerFlag.LOG_TIMESTAMP,""));
117+
usingPort(4000).withArgument(GeneralServerFlag.SESSION_OVERRIDE,""));
109118
service.start();
110119
assertEquals(true, service.isRunning());
111120
service.stop();

0 commit comments

Comments
 (0)