View Javadoc
1   /*
2    * SmartSprites Project
3    *
4    * Copyright (C) 2007-2009, Stanisław Osiński.
5    * All rights reserved.
6    *
7    * Redistribution and use in source and binary forms, with or without modification,
8    * are permitted provided that the following conditions are met:
9    *
10   * - Redistributions of  source code must  retain the above  copyright notice, this
11   *   list of conditions and the following disclaimer.
12   *
13   * - Redistributions in binary form must reproduce the above copyright notice, this
14   *   list of conditions and the following  disclaimer in  the documentation  and/or
15   *   other materials provided with the distribution.
16   *
17   * - Neither the name of the SmartSprites Project nor the names of its contributors
18   *   may  be used  to endorse  or  promote  products derived   from  this  software
19   *   without specific prior written permission.
20   *
21   * - We kindly request that you include in the end-user documentation provided with
22   *   the redistribution and/or in the software itself an acknowledgement equivalent
23   *   to  the  following: "This product includes software developed by the SmartSprites
24   *   Project."
25   *
26   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"  AND
27   * ANY EXPRESS OR  IMPLIED WARRANTIES, INCLUDING,  BUT NOT LIMITED  TO, THE IMPLIED
28   * WARRANTIES  OF  MERCHANTABILITY  AND  FITNESS  FOR  A  PARTICULAR  PURPOSE   ARE
29   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE  FOR
30   * ANY DIRECT, INDIRECT, INCIDENTAL,  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  DAMAGES
31   * (INCLUDING, BUT  NOT LIMITED  TO, PROCUREMENT  OF SUBSTITUTE  GOODS OR SERVICES;
32   * LOSS OF USE, DATA, OR PROFITS;  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND  ON
33   * ANY  THEORY  OF  LIABILITY,  WHETHER  IN  CONTRACT,  STRICT  LIABILITY,  OR TORT
34   * (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY WAY  OUT OF THE USE  OF THIS
35   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36   */
37  package org.carrot2.labs.test;
38  
39  import java.awt.image.BufferedImage;
40  import java.util.List;
41  
42  import org.carrot2.labs.smartsprites.css.CssProperty;
43  import org.carrot2.labs.smartsprites.message.Message;
44  
45  /**
46   * FEST-style assertions for SmartSprites-specific data types.
47   */
48  public class Assertions {
49  
50      /**
51       * Creates a {@link MessageAssertion}.
52       *
53       * @param actual
54       *            the actual
55       *
56       * @return the message assertion
57       */
58      public static MessageAssertion assertThat(Message actual) {
59          return new MessageAssertion(actual);
60      }
61  
62      /**
63       * Creates a {@link MessageListAssertion}.
64       *
65       * @param actual
66       *            the actual
67       *
68       * @return the message list assertion
69       */
70      public static MessageListAssertion assertThat(List<Message> actual) {
71          return new MessageListAssertion(actual);
72      }
73  
74      /**
75       * Creates a {@link CssPropertyAssertion}.
76       *
77       * @param actual
78       *            the actual
79       *
80       * @return the css property assertion
81       */
82      public static CssPropertyAssertion assertThat(CssProperty actual) {
83          return new CssPropertyAssertion(actual);
84      }
85  
86      /**
87       * Creates a {@link CssPropertyListAssertion}.
88       *
89       * @param actual
90       *            the actual
91       *
92       * @return the css property list assertion
93       */
94      public static CssPropertyListAssertion assertThatCssPropertyList(List<CssProperty> actual) {
95          return new CssPropertyListAssertion(actual);
96      }
97  
98      /**
99       * Creates a {@link BufferedImageAssertion}.
100      *
101      * @param actual
102      *            the actual
103      *
104      * @return the buffered image assertion
105      */
106     public static BufferedImageAssertion assertThat(BufferedImage actual) {
107         return new BufferedImageAssertion(actual);
108     }
109 }