001/** 002 * Powerunit - A JDK1.8 test framework 003 * Copyright (C) 2014 Mathieu Boretti. 004 * 005 * This file is part of Powerunit 006 * 007 * Powerunit is free software: you can redistribute it and/or modify 008 * it under the terms of the GNU General Public License as published by 009 * the Free Software Foundation, either version 3 of the License, or 010 * (at your option) any later version. 011 * 012 * Powerunit is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU General Public License 018 * along with Powerunit. If not, see <http://www.gnu.org/licenses/>. 019 */ 020package ch.powerunit; 021 022/** 023 * This is an intermediate and optional step on assertion to cast an object into 024 * a sub-object. 025 * 026 * @author borettim 027 * @since 0.3.0 028 * @param <T> 029 * the object type. 030 */ 031public interface AssertThatCastableObject<T> extends AssertThatObject<T> { 032 /** 033 * Cast the received value into a sub-class of the receiver, before applying 034 * the matcher. 035 * 036 * @param clazz 037 * the target class 038 * @return {@link AssertThatObject the assertion on the result of the 039 * conversion}. 040 * @param <P> 041 * The subtype for the conversion 042 */ 043 <P extends T> AssertThatObject<P> as(Class<P> clazz); 044}