Skip to content

Commit 6b5fbaa

Browse files
committed
Fixed issues with failing test cases in automate client
1 parent 34d7595 commit 6b5fbaa

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

src/main/java/com/browserstack/automate/AutomateClient.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,14 @@ public final List<Browser> getBrowsers(final boolean cache) throws AutomateExcep
9696
*/
9797
public final List<Project> getProjects() throws AutomateException {
9898
List<Project> projects = new ArrayList<Project>();
99-
ProjectNode[] projectNodes;
10099

101100
try {
102-
projectNodes = newRequest(Method.GET, "/projects.json")
103-
.asObject(ProjectNode[].class);
101+
projects = Arrays.asList(newRequest(Method.GET, "/projects.json")
102+
.asObject(Project[].class));
104103
} catch (BrowserStackException e) {
105104
throw new AutomateException(e);
106105
}
107106

108-
for (ProjectNode pn : projectNodes) {
109-
if (pn != null && pn.getProject() != null) {
110-
projects.add(pn.getProject().<Project>setClient(this));
111-
}
112-
}
113-
114107
return projects;
115108
}
116109

src/main/java/com/browserstack/automate/model/Project.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,10 @@ public List<Build> getBuilds() throws AutomateException {
176176
}
177177

178178
/**
179-
* @param buildNodes The builds
179+
* @param builds The builds
180180
*/
181181
@JsonProperty("builds")
182-
private void setBuilds(List<BuildNode> buildNodes) {
183-
List<Build> builds = new ArrayList<Build>();
184-
185-
if (buildNodes != null) {
186-
for (BuildNode buildNode : buildNodes) {
187-
if (buildNode != null && buildNode.getBuild() != null) {
188-
builds.add(buildNode.getBuild());
189-
}
190-
}
191-
}
192-
182+
private void setBuilds(List<Build> builds) {
193183
this.builds = builds;
194184
}
195185

src/test/java/com/browserstack/automate/AutomateClientTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.junit.Test;
1515

1616
import java.util.List;
17+
import java.util.regex.Pattern;
1718

1819
import static org.junit.Assert.assertEquals;
1920
import static org.junit.Assert.assertTrue;
@@ -223,7 +224,7 @@ public void testGetSessionVideo() {
223224

224225
String videoUrl1 = sessions.get(0).getVideoUrl();
225226
String videoUrl2 = automateClient.getSessionVideo(sessions.get(0).getId());
226-
assertEquals(videoUrl1, videoUrl2);
227+
assertEquals(videoUrl1.split(Pattern.quote("?"))[0], videoUrl2.split(Pattern.quote("?"))[0]);
227228
} catch (BuildNotFound e) {
228229
assertTrue(false);
229230
} catch (SessionNotFound e) {

0 commit comments

Comments
 (0)