View Javadoc

1   package com.atlassian.selenium.visualcomparison.v2;
2   
3   import javax.annotation.Nonnull;
4   import javax.annotation.Nullable;
5   
6   import static com.google.common.base.Preconditions.checkNotNull;
7   
8   /**
9    * Raised when {@link Comparer#compare(String) visual comparison} fails for any reason. The details of the comparison
10   * and the problem should be provided by this exception.
11   *
12   * @since 2.3
13   */
14  public class VisualComparisonFailedException extends RuntimeException
15  {
16      private final String id;
17      // more context?
18  
19      public VisualComparisonFailedException(@Nonnull String id)
20      {
21          this.id = checkNotNull(id, "id");
22      }
23  
24      public VisualComparisonFailedException(@Nonnull String id, @Nullable String message)
25      {
26          super(message);
27          this.id = checkNotNull(id, "id");
28      }
29  
30      public VisualComparisonFailedException(@Nonnull String id, @Nullable String message, @Nullable Throwable cause)
31      {
32          super(message, cause);
33          this.id = checkNotNull(id, "id");
34      }
35  
36      /**
37       * @return Comparison ID
38       */
39      @Nonnull
40      public String getId()
41      {
42          return id;
43      }
44  }