001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.assertions; 014 015import org.apache.juneau.internal.*; 016 017/** 018 * Used for assertion calls against throwable objects. 019 * 020 * <h5 class='section'>Example:</h5> 021 * <p class='bcode w800'> 022 * <jc>// Validates the throwable message or one of the parent messages contain 'Foobar'.</jc> 023 * <jsm>assertThrowable</jsm>(<jv>throwable</jv>).contains(<js>"Foobar"</js>); 024 * </p> 025 */ 026@FluentSetters(returns="ThrowableAssertion") 027public class ThrowableAssertion extends FluentThrowableAssertion<ThrowableAssertion> { 028 029 /** 030 * Creator. 031 * 032 * @param value The throwable being wrapped. 033 * @return A new {@link ThrowableAssertion} object. 034 */ 035 public static ThrowableAssertion create(Throwable value) { 036 return new ThrowableAssertion(value); 037 } 038 039 /** 040 * Creator. 041 * 042 * @param value The throwable being wrapped. 043 */ 044 public ThrowableAssertion(Throwable value) { 045 super(value, null); 046 } 047 048 @Override 049 protected ThrowableAssertion returns() { 050 return this; 051 } 052 053 // <FluentSetters> 054 055 @Override /* GENERATED - Assertion */ 056 public ThrowableAssertion msg(String msg, Object...args) { 057 super.msg(msg, args); 058 return this; 059 } 060 061 @Override /* GENERATED - Assertion */ 062 public ThrowableAssertion stderr() { 063 super.stderr(); 064 return this; 065 } 066 067 @Override /* GENERATED - Assertion */ 068 public ThrowableAssertion stdout() { 069 super.stdout(); 070 return this; 071 } 072 073 // </FluentSetters> 074}