Custom Input Annotations
Custom input annotations allow particular inputs to be recommended to Diffblue Cover when writing tests.
Using @InTestsUseStrings
@InTestsUseStringspublic static boolean isDayRelatedSongTitle(@InTestsUseStrings({"I Don't Like Mondays", "Here Comes The Weekend"}) String title) {
return Stream.of(DayOfWeek.values())
.map(DayOfWeek::name)
.map(String::toLowerCase)
.anyMatch(title.toLowerCase()::contains);
}Using @InTestsUseIntegers
@InTestsUseIntegerspublic static String toUpperHexString(@InTestsUseIntegers(0xD1FFB) int input) {
return Long.toHexString(input).toUpperCase();
}Using @InTestsUseShorts
@InTestsUseShortspublic static String toUpperHexString(@InTestsUseShorts((short) 0xD1FF) short input) {
return Long.toHexString(input).toUpperCase();
}Using @InTestsUseLongs
@InTestsUseLongsUsing @InTestsUseBytes
@InTestsUseBytesUsing @InTestsUseFloats
@InTestsUseFloatsUsing @InTestsUseDoubles
@InTestsUseDoublesUsing @InTestsUseEnums
@InTestsUseEnumsUsing @InTestsUseClasses
@InTestsUseClassesUsing @InTestsUseCharacters
@InTestsUseCharactersUsing @InTestsUseFactories
@InTestsUseFactoriesLast updated
Was this helpful?

