001 /**
002 * Copyright (C) 2011 rwoo@gmx.de
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package com.googlecode.catchexception.throwable.apis;
017
018 /**
019 * Supports <a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development">BDD</a>-like approach to catch and verify
020 * throwables (<i>given/when/then</i>).
021 * <p>
022 * EXAMPLE: <code><pre class="prettyprint lang-java">// given an empty list
023 List myList = new ArrayList();
024
025 // when we try to get the first element of the list
026 when(myList).get(1);
027
028 // then we expect an IndexOutOfBoundsThrowable
029 then(caughtThrowable())
030 .isInstanceOf(IndexOutOfBoundsThrowable.class)
031 .hasMessage("Index: 1, Size: 0")
032 .hasNoCause();
033
034 // then we expect an IndexOutOfBoundsThrowable (alternatively)
035 thenThrown(IndexOutOfBoundsThrowable.class);
036 </pre></code>
037 *
038 * @author rwoo
039 * @since 1.2.0
040 * @deprecated As of release 1.3.0, replaced by {@link com.googlecode.catchexception.throwable.apis.BDDCatchThrowable()}
041 * @see org.assertj.core.api.Assertions#assertThat(Throwable)
042 */
043 @Deprecated
044 public class CatchThrowableAssertJ extends BDDCatchThrowable{
045
046 }