View Javadoc

1   package com.atlassian.selenium.visualcomparison.v2.settings;
2   
3   import com.atlassian.annotations.ExperimentalApi;
4   
5   import javax.annotation.Nonnull;
6   import javax.annotation.concurrent.Immutable;
7   
8   import static com.google.common.base.Preconditions.checkNotNull;
9   
10  /**
11   * Replacement for part of the compared page with some alternative {@code html}.
12   *
13   * <p/>
14   * Currently the only way to identify the replaced part is by element ID, but this is subject to change in the future.
15   *
16   * @since 2.3
17   */
18  @Immutable
19  @ExperimentalApi
20  public class Replacement
21  {
22      private final String elementId;
23      private final String html;
24  
25      private Replacement(String elementId, String html)
26      {
27          this.elementId = elementId;
28          this.html = html;
29      }
30  
31      @Nonnull
32      public static Replacement forId(@Nonnull String elementId, @Nonnull String html)
33      {
34          return new Replacement(checkNotNull(elementId, "id"), checkNotNull(html, "html"));
35      }
36  
37      @Nonnull
38      public String getElementId()
39      {
40          return elementId;
41      }
42  
43      @Nonnull
44      public String getHtml()
45      {
46          return html;
47      }
48  }