Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2012-2024 the original author or authors.
*/
package org.assertj.guava.api;
import org.assertj.core.api.InstanceOfAssertFactory;
import com.google.common.base.Optional;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multiset;
import com.google.common.collect.Range;
import com.google.common.collect.RangeMap;
import com.google.common.collect.RangeSet;
import com.google.common.collect.Table;
import com.google.common.io.ByteSource;
/**
* {@link InstanceOfAssertFactory} instances for Guava types.
*
* @author Stefano Cordio
* @since 3.3.0
* @see org.assertj.core.api.InstanceOfAssertFactories
*/
public interface InstanceOfAssertFactories {
/**
* {@link InstanceOfAssertFactory} for a {@link ByteSource}.
*/
InstanceOfAssertFactory BYTE_SOURCE = new InstanceOfAssertFactory<>(ByteSource.class,
Assertions::assertThat);
/**
* {@link InstanceOfAssertFactory} for a {@link Multimap}, assuming {@code Object} as key and value types.
*
* @see #multimap(Class, Class)
*/
@SuppressWarnings("rawtypes") // rawtypes: using Class instance
InstanceOfAssertFactory> MULTIMAP = multimap(Object.class, Object.class);
/**
* {@link InstanceOfAssertFactory} for a {@link Multimap}.
*
* @param the {@code Multimap} key type.
* @param the {@code Multimap} value type.
* @param keyType the key type instance.
* @param valueType the value type instance.
* @return the factory instance.
*
* @see #MULTIMAP
*/
@SuppressWarnings({ "rawtypes", "unused" }) // rawtypes: using Class instance, unused: parameter needed for type inference
static InstanceOfAssertFactory> multimap(Class keyType, Class valueType) {
return new InstanceOfAssertFactory<>(Multimap.class, Assertions:: assertThat);
}
/**
* {@link InstanceOfAssertFactory} for an {@link Optional}, assuming {@code Object} as value type.
*
* @see #optional(Class)
*/
@SuppressWarnings("rawtypes") // rawtypes: using Class instance
InstanceOfAssertFactory> OPTIONAL = optional(Object.class);
/**
* {@link InstanceOfAssertFactory} for an {@link Optional}.
*
* @param the {@code Optional} value type.
* @param resultType the value type instance.
* @return the factory instance.
*
* @see #OPTIONAL
*/
@SuppressWarnings({ "rawtypes", "unused" }) // rawtypes: using Class instance, unused: parameter needed for type inference
static InstanceOfAssertFactory> optional(Class resultType) {
return new InstanceOfAssertFactory<>(Optional.class, Assertions:: assertThat);
}
/**
* {@link InstanceOfAssertFactory} for a {@link Range}.
*
* @param the {@code Comparable} type.
* @param comparableType the comparable type instance.
* @return the factory instance.
*/
@SuppressWarnings({ "rawtypes", "unused" }) // rawtypes: using Class instance, unused: parameter needed for type inference
static > InstanceOfAssertFactory> range(Class comparableType) {
return new InstanceOfAssertFactory<>(Range.class, Assertions:: assertThat);
}
/**
* {@link InstanceOfAssertFactory} for a {@link RangeMap}.
*
* @param the {@code RangeMap} key type.
* @param the {@code RangeMap} value type.
* @param keyType the key type instance.
* @param valueType the value type instance.
* @return the factory instance.
*/
@SuppressWarnings({ "rawtypes", "unused" }) // rawtypes: using Class instance, unused: parameter needed for type inference
static , V> InstanceOfAssertFactory> rangeMap(Class keyType,
Class valueType) {
return new InstanceOfAssertFactory<>(RangeMap.class, Assertions:: assertThat);
}
/**
* {@link InstanceOfAssertFactory} for a {@link RangeSet}.
*
* @param comparableType the comparable type instance.
* @param the {@code Comparable} type.
* @return the factory instance
*/
@SuppressWarnings({ "rawtypes", "unused" }) // rawtypes: using Class instance, unused: parameter needed for type inference
static > InstanceOfAssertFactory> rangeSet(Class comparableType) {
return new InstanceOfAssertFactory<>(RangeSet.class, Assertions:: assertThat);
}
/**
* {@link InstanceOfAssertFactory} for a {@link Table}, assuming {@code Object} as row key type, column key type and
* value type.
*
* @see #table(Class, Class, Class)
*/
@SuppressWarnings("rawtypes") // rawtypes: using Class instance
InstanceOfAssertFactory
> TABLE = table(Object.class, Object.class, Object.class);
/**
* {@link InstanceOfAssertFactory} for a {@link Table}.
*
* @param the {@code Table} row key type.
* @param the {@code Table} column key type.
* @param the {@code Table} value type.
* @param rowKeyType the row key type instance.
* @param columnKeyType the column key type instance.
* @param valueType the value type instance.
* @return the factory instance.
*
* @see #TABLE
*/
@SuppressWarnings({ "rawtypes", "unused" }) // rawtypes: using Class instance, unused: parameter needed for type inference
static InstanceOfAssertFactory
> table(Class rowKeyType, Class columnKeyType,
Class valueType) {
return new InstanceOfAssertFactory<>(Table.class, Assertions:: assertThat);
}
/**
* {@link InstanceOfAssertFactory} for a {@link Multiset}, assuming {@code Object} as element type.
*
* @see #multiset(Class)
*/
@SuppressWarnings("rawtypes") // rawtypes: using Class instance
InstanceOfAssertFactory> MULTISET = multiset(Object.class);
/**
* {@link InstanceOfAssertFactory} for a {@link Multiset}.
*
* @param the {@code Multiset} element type.
* @param elementType the element type instance.
* @return the factory instance.
*
* @see #MULTISET
*/
@SuppressWarnings({ "rawtypes", "unused" }) // rawtypes: using Class instance, unused: parameter needed for type inference
static InstanceOfAssertFactory> multiset(Class elementType) {
return new InstanceOfAssertFactory<>(Multiset.class, Assertions:: assertThat);
}
}