2. Methods, Classes & OOP for Test Architecture

Classes and Encapsulation

public class TestEnvironment {
    private final String baseUrl;
    private final int defaultTimeout;

public TestEnvironment(String baseUrl, int defaultTimeout) {
this.baseUrl = baseUrl;
this.defaultTimeout = defaultTimeout;
}

public String getBaseUrl() {
return this.baseUrl;
}
}

Task

  • Implement TestEnvironment:
  • 1. Constructor accepts String baseUrl and int timeout.
  • 2. Method getBaseUrl() returns baseUrl.
πŸ’‘Common doubts
Did you like the problem?
Lesson 2 of 18
Java
Loading code editor…
Next