Interface CodeUnitsShould<CONJUNCTION extends CodeUnitsShouldConjunction<?>>
-
- All Superinterfaces:
MembersShould<CONJUNCTION>
- All Known Subinterfaces:
MethodsShould<CONJUNCTION>
public interface CodeUnitsShould<CONJUNCTION extends CodeUnitsShouldConjunction<?>> extends MembersShould<CONJUNCTION>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CONJUNCTION
declareThrowableOfType(DescribedPredicate<? super JavaClass> predicate)
Asserts thatJavaCodeUnits
declare aThrowable
which matches the given predicate.CONJUNCTION
declareThrowableOfType(java.lang.Class<? extends java.lang.Throwable> type)
Asserts thatJavaCodeUnits
declare aThrowable
of the specified type in their throws clause.CONJUNCTION
declareThrowableOfType(java.lang.String typeName)
Asserts thatJavaCodeUnits
declare aThrowable
of the specified fully qualified type name in their throws clause.CONJUNCTION
haveRawParameterTypes(DescribedPredicate<? super java.util.List<JavaClass>> predicate)
Asserts thatJavaCodeUnits
have raw parameter types matching the given predicate.CONJUNCTION
haveRawParameterTypes(java.lang.Class<?>... parameterTypes)
Asserts thatJavaCodeUnits
have the specified raw parameter types.CONJUNCTION
haveRawParameterTypes(java.lang.String... parameterTypeNames)
Asserts thatJavaCodeUnits
have the specified fully qualified raw parameter type names.CONJUNCTION
haveRawReturnType(DescribedPredicate<? super JavaClass> predicate)
Asserts thatJavaCodeUnits
have raw return types matching the given predicate.CONJUNCTION
haveRawReturnType(java.lang.Class<?> type)
Asserts thatJavaCodeUnits
have the specified raw return type.CONJUNCTION
haveRawReturnType(java.lang.String typeName)
Asserts thatJavaCodeUnits
have the specified fully qualified raw return type name.CONJUNCTION
notDeclareThrowableOfType(DescribedPredicate<? super JavaClass> predicate)
Asserts thatJavaCodeUnits
do not declare aThrowable
which matches the given predicate.CONJUNCTION
notDeclareThrowableOfType(java.lang.Class<? extends java.lang.Throwable> type)
Asserts thatJavaCodeUnits
do not declare aThrowable
of the specified type in their throws clause.CONJUNCTION
notDeclareThrowableOfType(java.lang.String typeName)
Asserts thatJavaCodeUnits
do not declare aThrowable
of the specified fully qualified type name in their throws clause.CONJUNCTION
notHaveRawParameterTypes(DescribedPredicate<? super java.util.List<JavaClass>> predicate)
Asserts thatJavaCodeUnits
do not have raw parameter types matching the given predicate.CONJUNCTION
notHaveRawParameterTypes(java.lang.Class<?>... parameterTypes)
Asserts thatJavaCodeUnits
do not have the specified raw parameter types.CONJUNCTION
notHaveRawParameterTypes(java.lang.String... parameterTypeNames)
Asserts thatJavaCodeUnits
do not have the specified fully qualified raw parameter type names.CONJUNCTION
notHaveRawReturnType(DescribedPredicate<? super JavaClass> predicate)
Asserts thatJavaCodeUnits
do not have raw return types matching the given predicate.CONJUNCTION
notHaveRawReturnType(java.lang.Class<?> type)
Asserts thatJavaCodeUnits
do not have the specified raw return type.CONJUNCTION
notHaveRawReturnType(java.lang.String typeName)
Asserts thatJavaCodeUnits
do not have the specified fully qualified raw return type name.-
Methods inherited from interface com.tngtech.archunit.lang.syntax.elements.MembersShould
beAnnotatedWith, beAnnotatedWith, beAnnotatedWith, beDeclaredIn, beDeclaredIn, beDeclaredInClassesThat, beDeclaredInClassesThat, beMetaAnnotatedWith, beMetaAnnotatedWith, beMetaAnnotatedWith, bePackagePrivate, bePrivate, beProtected, bePublic, haveFullName, haveFullNameMatching, haveFullNameNotMatching, haveModifier, haveName, haveNameContaining, haveNameEndingWith, haveNameMatching, haveNameNotContaining, haveNameNotEndingWith, haveNameNotMatching, haveNameNotStartingWith, haveNameStartingWith, notBeAnnotatedWith, notBeAnnotatedWith, notBeAnnotatedWith, notBeDeclaredIn, notBeDeclaredIn, notBeMetaAnnotatedWith, notBeMetaAnnotatedWith, notBeMetaAnnotatedWith, notBePackagePrivate, notBePrivate, notBeProtected, notBePublic, notHaveFullName, notHaveModifier, notHaveName
-
-
-
-
Method Detail
-
haveRawParameterTypes
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawParameterTypes(java.lang.Class<?>... parameterTypes)
Asserts thatJavaCodeUnits
have the specified raw parameter types.
E.g.
would be violated bycodeUnits()
.should()
.haveRawParameterTypes(String.class, int.class)
someMethod
inclass Example { void someMethod(Object wrongParam, int intParam) {...} }
- Parameters:
parameterTypes
- Parameter typesJavaCodeUnits
should have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notHaveRawParameterTypes
@PublicAPI(usage=ACCESS) CONJUNCTION notHaveRawParameterTypes(java.lang.Class<?>... parameterTypes)
Asserts thatJavaCodeUnits
do not have the specified raw parameter types.
E.g.
would be violated bycodeUnits()
.should()
.notHaveRawParameterTypes(String.class, int.class)
someMethod
inclass Example { void someMethod(String stringParam, int intParam) {...} }
- Parameters:
parameterTypes
- Parameter typesJavaCodeUnits
should not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawParameterTypes
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawParameterTypes(java.lang.String... parameterTypeNames)
Asserts thatJavaCodeUnits
have the specified fully qualified raw parameter type names.
E.g.
would be violated bycodeUnits()
.should()
.haveRawParameterTypes(String.class.getName(), int.class.getName())
someMethod
inclass Example { void someMethod(Object wrongParam, int intParam) {...} }
- Parameters:
parameterTypeNames
- Fully qualified names of parameter typesJavaCodeUnits
should have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notHaveRawParameterTypes
@PublicAPI(usage=ACCESS) CONJUNCTION notHaveRawParameterTypes(java.lang.String... parameterTypeNames)
Asserts thatJavaCodeUnits
do not have the specified fully qualified raw parameter type names.
E.g.
would be violated bycodeUnits()
.should()
.notHaveRawParameterTypes(String.class.getName(), int.class.getName())
someMethod
inclass Example { void someMethod(String stringParam, int intParam) {...} }
- Parameters:
parameterTypeNames
- Fully qualified names of parameter typesJavaCodeUnits
should not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawParameterTypes
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawParameterTypes(DescribedPredicate<? super java.util.List<JavaClass>> predicate)
Asserts thatJavaCodeUnits
have raw parameter types matching the given predicate.
E.g.
would be violated bycodeUnits()
.should()
.haveRawParameterTypes(whereFirstTypeIs(String.class))
someMethod
inclass Example { void someMethod(Object wrongParam, int intParam) {...} }
- Parameters:
predicate
- ADescribedPredicate
that determines, whichJavaCodeUnits
match by their raw parameter types- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notHaveRawParameterTypes
@PublicAPI(usage=ACCESS) CONJUNCTION notHaveRawParameterTypes(DescribedPredicate<? super java.util.List<JavaClass>> predicate)
Asserts thatJavaCodeUnits
do not have raw parameter types matching the given predicate.
E.g.
would be violated bycodeUnits()
.should()
.notHaveRawParameterTypes(whereFirstTypeIs(String.class))
someMethod
inclass Example { void someMethod(String stringParam, int intParam) {...} }
- Parameters:
predicate
- ADescribedPredicate
that determines, whichJavaCodeUnits
do not match by their raw parameter types- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawReturnType
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawReturnType(java.lang.Class<?> type)
Asserts thatJavaCodeUnits
have the specified raw return type.
E.g.
would be violated bycodeUnits()
.should()
.haveRawReturnType(String.class)
someMethod
inclass Example { Object someMethod() {...} }
- Parameters:
type
- Return typeJavaCodeUnits
should have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notHaveRawReturnType
@PublicAPI(usage=ACCESS) CONJUNCTION notHaveRawReturnType(java.lang.Class<?> type)
Asserts thatJavaCodeUnits
do not have the specified raw return type.
E.g.
would be violated bycodeUnits()
.should()
.notHaveRawReturnType(String.class)
someMethod
inclass Example { String someMethod() {...} }
- Parameters:
type
- Return typeJavaCodeUnits
should not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawReturnType
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawReturnType(java.lang.String typeName)
Asserts thatJavaCodeUnits
have the specified fully qualified raw return type name.
E.g.
would be violated bycodeUnits()
.should()
.haveRawReturnType(String.class.getName())
someMethod
inclass Example { Object someMethod() {...} }
- Parameters:
typeName
- Fully qualified name of a return typeJavaCodeUnits
should have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notHaveRawReturnType
@PublicAPI(usage=ACCESS) CONJUNCTION notHaveRawReturnType(java.lang.String typeName)
Asserts thatJavaCodeUnits
do not have the specified fully qualified raw return type name.
E.g.
would be violated bycodeUnits()
.should()
.notHaveRawReturnType(String.class.getName())
someMethod
inclass Example { String someMethod() {...} }
- Parameters:
typeName
- Fully qualified name of a return typeJavaCodeUnits
should not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawReturnType
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawReturnType(DescribedPredicate<? super JavaClass> predicate)
Asserts thatJavaCodeUnits
have raw return types matching the given predicate.
E.g.
would be violated bycodeUnits()
.should()
.haveRawReturnType(assignableTo(Serializable.class))
someMethod
inclass Example { Object someMethod() {...} }
- Parameters:
predicate
- ADescribedPredicate
that determines, whichJavaCodeUnits
match by their raw return types- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notHaveRawReturnType
@PublicAPI(usage=ACCESS) CONJUNCTION notHaveRawReturnType(DescribedPredicate<? super JavaClass> predicate)
Asserts thatJavaCodeUnits
do not have raw return types matching the given predicate.
E.g.
would be violated bycodeUnits()
.should()
.notHaveRawReturnType(assignableTo(Serializable.class))
someMethod
inclass Example { String someMethod() {...} }
- Parameters:
predicate
- ADescribedPredicate
that determines, whichJavaCodeUnits
do not match by their raw return types- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
declareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION declareThrowableOfType(java.lang.Class<? extends java.lang.Throwable> type)
Asserts thatJavaCodeUnits
declare aThrowable
of the specified type in their throws clause.
E.g.
would be violated bycodeUnits()
.should()
.declareThrowableOfType(SomeException.class)
someMethod
inclass Example { void someMethod() throws WrongException {...} }
- Parameters:
type
- Type of a declaredThrowable
JavaCodeUnits
should have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notDeclareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION notDeclareThrowableOfType(java.lang.Class<? extends java.lang.Throwable> type)
Asserts thatJavaCodeUnits
do not declare aThrowable
of the specified type in their throws clause.
E.g.
would be violated bycodeUnits()
.should()
.notDeclareThrowableOfType(SomeException.class)
someMethod
inclass Example { void someMethod() throws SomeException {...} }
- Parameters:
type
- Type of a declaredThrowable
JavaCodeUnits
should not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
declareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION declareThrowableOfType(java.lang.String typeName)
Asserts thatJavaCodeUnits
declare aThrowable
of the specified fully qualified type name in their throws clause.
E.g.
would be violated bycodeUnits()
.should()
.declareThrowableOfType(SomeException.class.getName())
someMethod
inclass Example { void someMethod() throws WrongException {...} }
- Parameters:
typeName
- Fully qualified name of a type of a declaredThrowable
JavaCodeUnits
should have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notDeclareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION notDeclareThrowableOfType(java.lang.String typeName)
Asserts thatJavaCodeUnits
do not declare aThrowable
of the specified fully qualified type name in their throws clause.
E.g.
would be violated bycodeUnits()
.should()
.notDeclareThrowableOfType(SomeException.class.getName())
someMethod
inclass Example { void someMethod() throws SomeException {...} }
- Parameters:
typeName
- Fully qualified name of a type of a declaredThrowable
JavaCodeUnits
should not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
declareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION declareThrowableOfType(DescribedPredicate<? super JavaClass> predicate)
Asserts thatJavaCodeUnits
declare aThrowable
which matches the given predicate.
E.g.
would be violated bycodeUnits()
.should()
.declareThrowableOfType(nameStartingWith("Some"))
someMethod
inclass Example { void someMethod() throws WrongException {...} }
- Parameters:
predicate
- ADescribedPredicate
that determines, whichJavaCodeUnits
match by their declaredThrowable
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notDeclareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION notDeclareThrowableOfType(DescribedPredicate<? super JavaClass> predicate)
Asserts thatJavaCodeUnits
do not declare aThrowable
which matches the given predicate.
E.g.
would be violated bycodeUnits()
.should()
.notDeclareThrowableOfType(nameStartingWith("Some"))
someMethod
inclass Example { void someMethod() throws SomeException {...} }
- Parameters:
predicate
- ADescribedPredicate
that determines, whichJavaCodeUnits
do not match by their declaredThrowable
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
-