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 CONJUNCTIONdeclareThrowableOfType(DescribedPredicate<JavaClass> predicate)Asserts thatJavaCodeUnitsdeclare aThrowablewhich matches the given predicate.CONJUNCTIONdeclareThrowableOfType(java.lang.Class<? extends java.lang.Throwable> type)Asserts thatJavaCodeUnitsdeclare aThrowableof the specified type in their throws clause.CONJUNCTIONdeclareThrowableOfType(java.lang.String typeName)Asserts thatJavaCodeUnitsdeclare aThrowableof the specified fully qualified type name in their throws clause.CONJUNCTIONhaveRawParameterTypes(DescribedPredicate<java.util.List<JavaClass>> predicate)Asserts thatJavaCodeUnitshave raw parameter types matching the given predicate.CONJUNCTIONhaveRawParameterTypes(java.lang.Class<?>... parameterTypes)Asserts thatJavaCodeUnitshave the specified raw parameter types.CONJUNCTIONhaveRawParameterTypes(java.lang.String... parameterTypeNames)Asserts thatJavaCodeUnitshave the specified fully qualified raw parameter type names.CONJUNCTIONhaveRawReturnType(DescribedPredicate<JavaClass> predicate)Asserts thatJavaCodeUnitshave raw return types matching the given predicate.CONJUNCTIONhaveRawReturnType(java.lang.Class<?> type)Asserts thatJavaCodeUnitshave the specified raw return type.CONJUNCTIONhaveRawReturnType(java.lang.String typeName)Asserts thatJavaCodeUnitshave the specified fully qualified raw return type name.CONJUNCTIONnotDeclareThrowableOfType(DescribedPredicate<JavaClass> predicate)Asserts thatJavaCodeUnitsdo not declare aThrowablewhich matches the given predicate.CONJUNCTIONnotDeclareThrowableOfType(java.lang.Class<? extends java.lang.Throwable> type)Asserts thatJavaCodeUnitsdo not declare aThrowableof the specified type in their throws clause.CONJUNCTIONnotDeclareThrowableOfType(java.lang.String typeName)Asserts thatJavaCodeUnitsdo not declare aThrowableof the specified fully qualified type name in their throws clause.CONJUNCTIONnotHaveRawParameterTypes(DescribedPredicate<java.util.List<JavaClass>> predicate)Asserts thatJavaCodeUnitsdo not have raw parameter types matching the given predicate.CONJUNCTIONnotHaveRawParameterTypes(java.lang.Class<?>... parameterTypes)Asserts thatJavaCodeUnitsdo not have the specified raw parameter types.CONJUNCTIONnotHaveRawParameterTypes(java.lang.String... parameterTypeNames)Asserts thatJavaCodeUnitsdo not have the specified fully qualified raw parameter type names.CONJUNCTIONnotHaveRawReturnType(DescribedPredicate<JavaClass> predicate)Asserts thatJavaCodeUnitsdo not have raw return types matching the given predicate.CONJUNCTIONnotHaveRawReturnType(java.lang.Class<?> type)Asserts thatJavaCodeUnitsdo not have the specified raw return type.CONJUNCTIONnotHaveRawReturnType(java.lang.String typeName)Asserts thatJavaCodeUnitsdo 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, haveNameMatching, haveNameNotMatching, 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 thatJavaCodeUnitshave the specified raw parameter types.
E.g.
would be violated bycodeUnits().should().haveRawParameterTypes(String.class, int.class)someMethodinclass Example { void someMethod(Object wrongParam, int intParam) {...} }- Parameters:
parameterTypes- Parameter typesJavaCodeUnitsshould 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 thatJavaCodeUnitsdo not have the specified raw parameter types.
E.g.
would be violated bycodeUnits().should().notHaveRawParameterTypes(String.class, int.class)someMethodinclass Example { void someMethod(String stringParam, int intParam) {...} }- Parameters:
parameterTypes- Parameter typesJavaCodeUnitsshould 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 thatJavaCodeUnitshave the specified fully qualified raw parameter type names.
E.g.
would be violated bycodeUnits().should().haveRawParameterTypes(String.class.getName(), int.class.getName())someMethodinclass Example { void someMethod(Object wrongParam, int intParam) {...} }- Parameters:
parameterTypeNames- Fully qualified names of parameter typesJavaCodeUnitsshould 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 thatJavaCodeUnitsdo not have the specified fully qualified raw parameter type names.
E.g.
would be violated bycodeUnits().should().notHaveRawParameterTypes(String.class.getName(), int.class.getName())someMethodinclass Example { void someMethod(String stringParam, int intParam) {...} }- Parameters:
parameterTypeNames- Fully qualified names of parameter typesJavaCodeUnitsshould not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawParameterTypes
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawParameterTypes(DescribedPredicate<java.util.List<JavaClass>> predicate)
Asserts thatJavaCodeUnitshave raw parameter types matching the given predicate.
E.g.
would be violated bycodeUnits().should().haveRawParameterTypes(whereFirstTypeIs(String.class))someMethodinclass Example { void someMethod(Object wrongParam, int intParam) {...} }- Parameters:
predicate- ADescribedPredicatethat determines, whichJavaCodeUnitsmatch 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<java.util.List<JavaClass>> predicate)
Asserts thatJavaCodeUnitsdo not have raw parameter types matching the given predicate.
E.g.
would be violated bycodeUnits().should().notHaveRawParameterTypes(whereFirstTypeIs(String.class))someMethodinclass Example { void someMethod(String stringParam, int intParam) {...} }- Parameters:
predicate- ADescribedPredicatethat determines, whichJavaCodeUnitsdo 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 thatJavaCodeUnitshave the specified raw return type.
E.g.
would be violated bycodeUnits().should().haveRawReturnType(String.class)someMethodinclass Example { Object someMethod() {...} }- Parameters:
type- Return typeJavaCodeUnitsshould 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 thatJavaCodeUnitsdo not have the specified raw return type.
E.g.
would be violated bycodeUnits().should().notHaveRawReturnType(String.class)someMethodinclass Example { String someMethod() {...} }- Parameters:
type- Return typeJavaCodeUnitsshould 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 thatJavaCodeUnitshave the specified fully qualified raw return type name.
E.g.
would be violated bycodeUnits().should().haveRawReturnType(String.class.getName())someMethodinclass Example { Object someMethod() {...} }- Parameters:
typeName- Fully qualified name of a return typeJavaCodeUnitsshould 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 thatJavaCodeUnitsdo not have the specified fully qualified raw return type name.
E.g.
would be violated bycodeUnits().should().notHaveRawReturnType(String.class.getName())someMethodinclass Example { String someMethod() {...} }- Parameters:
typeName- Fully qualified name of a return typeJavaCodeUnitsshould not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawReturnType
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawReturnType(DescribedPredicate<JavaClass> predicate)
Asserts thatJavaCodeUnitshave raw return types matching the given predicate.
E.g.
would be violated bycodeUnits().should().haveRawReturnType(assignableTo(Serializable.class))someMethodinclass Example { Object someMethod() {...} }- Parameters:
predicate- ADescribedPredicatethat determines, whichJavaCodeUnitsmatch 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<JavaClass> predicate)
Asserts thatJavaCodeUnitsdo not have raw return types matching the given predicate.
E.g.
would be violated bycodeUnits().should().notHaveRawReturnType(assignableTo(Serializable.class))someMethodinclass Example { String someMethod() {...} }- Parameters:
predicate- ADescribedPredicatethat determines, whichJavaCodeUnitsdo 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 thatJavaCodeUnitsdeclare aThrowableof the specified type in their throws clause.
E.g.
would be violated bycodeUnits().should().declareThrowableOfType(SomeException.class)someMethodinclass Example { void someMethod() throws WrongException {...} }- Parameters:
type- Type of a declaredThrowableJavaCodeUnitsshould 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 thatJavaCodeUnitsdo not declare aThrowableof the specified type in their throws clause.
E.g.
would be violated bycodeUnits().should().notDeclareThrowableOfType(SomeException.class)someMethodinclass Example { void someMethod() throws SomeException {...} }- Parameters:
type- Type of a declaredThrowableJavaCodeUnitsshould 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 thatJavaCodeUnitsdeclare aThrowableof the specified fully qualified type name in their throws clause.
E.g.
would be violated bycodeUnits().should().declareThrowableOfType(SomeException.class.getName())someMethodinclass Example { void someMethod() throws WrongException {...} }- Parameters:
typeName- Fully qualified name of a type of a declaredThrowableJavaCodeUnitsshould 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 thatJavaCodeUnitsdo not declare aThrowableof the specified fully qualified type name in their throws clause.
E.g.
would be violated bycodeUnits().should().notDeclareThrowableOfType(SomeException.class.getName())someMethodinclass Example { void someMethod() throws SomeException {...} }- Parameters:
typeName- Fully qualified name of a type of a declaredThrowableJavaCodeUnitsshould not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
declareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION declareThrowableOfType(DescribedPredicate<JavaClass> predicate)
Asserts thatJavaCodeUnitsdeclare aThrowablewhich matches the given predicate.
E.g.
would be violated bycodeUnits().should().declareThrowableOfType(nameStartingWith("Some"))someMethodinclass Example { void someMethod() throws WrongException {...} }- Parameters:
predicate- ADescribedPredicatethat determines, whichJavaCodeUnitsmatch by their declaredThrowable- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
notDeclareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION notDeclareThrowableOfType(DescribedPredicate<JavaClass> predicate)
Asserts thatJavaCodeUnitsdo not declare aThrowablewhich matches the given predicate.
E.g.
would be violated bycodeUnits().should().notDeclareThrowableOfType(nameStartingWith("Some"))someMethodinclass Example { void someMethod() throws SomeException {...} }- Parameters:
predicate- ADescribedPredicatethat determines, whichJavaCodeUnitsdo not match by their declaredThrowable- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
-