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 * Parent class of all fluent assertion calls.
019 *
020 * @param <R> The return type.
021 */
022@FluentSetters(returns="FluentAssertion<R>")
023public abstract class FluentAssertion<R> extends Assertion {
024
025   private final R returns;
026
027   /**
028    * Constructor.
029    *
030    * @param creator The assertion that created this assertion.
031    * @param returns The object to return after the test.
032    */
033   protected FluentAssertion(Assertion creator, R returns) {
034      super(creator);
035      this.returns = returns;
036   }
037
038   /**
039    * Returns the object that the fluent methods on this class should return.
040    *
041    * @return The response object.
042    */
043   protected R returns() {
044      return returns;
045   }
046
047   // <FluentSetters>
048
049   @Override /* GENERATED - Assertion */
050   public FluentAssertion<R> msg(String msg, Object...args) {
051      super.msg(msg, args);
052      return this;
053   }
054
055   @Override /* GENERATED - Assertion */
056   public FluentAssertion<R> stderr() {
057      super.stderr();
058      return this;
059   }
060
061   @Override /* GENERATED - Assertion */
062   public FluentAssertion<R> stdout() {
063      super.stdout();
064      return this;
065   }
066
067   // </FluentSetters>
068}