Skip to content

Commit b121327

Browse files
committed
BREAKING: junit: Use default element name in @DictionaryEntries
This allows for cleaner syntax (`@DictionaryEntries({"a", "b"})` and avoids introducing yet another term (`token`).
1 parent b0bcdc1 commit b121327

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

examples/junit/src/test/java/com/example/DictionaryFuzzTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class DictionaryFuzzTests {
3232
private static final byte[] FLAG_SHA256 =
3333
Base64.getDecoder().decode("vCLInoVuMxJonT4UKjsMl0LPXTowkYS7t0uBpw0pRo8=");
3434

35-
@DictionaryEntries(tokens = {"a_", "53Cr\"3T_", "fl4G"})
35+
@DictionaryEntries({"a_", "53Cr\"3T_", "fl4G"})
3636
@FuzzTest
3737
public void inlineTest(FuzzedDataProvider data)
3838
throws NoSuchAlgorithmException, TestSuccessfulException {
@@ -54,7 +54,7 @@ public void fileTest(FuzzedDataProvider data)
5454
}
5555
}
5656

57-
@DictionaryEntries(tokens = {"a_"})
57+
@DictionaryEntries("a_")
5858
@DictionaryFile(resourcePath = "test2.dict")
5959
@DictionaryFile(resourcePath = "/com/example/test3.dict")
6060
@FuzzTest

src/main/java/com/code_intelligence/jazzer/junit/DictionaryEntries.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import java.lang.annotation.Target;
2424

2525
/**
26-
* Adds the given strings to the fuzzer's dictionary. This is particularly useful for adding tokens
26+
* Adds the given strings to the fuzzer's dictionary. This is particularly useful for adding strings
2727
* that have special meaning in the context of your fuzz test, but are difficult for the fuzzer to
2828
* discover automatically.
2929
*
@@ -35,5 +35,5 @@
3535
@Repeatable(DictionaryEntriesList.class)
3636
public @interface DictionaryEntries {
3737
/** Individual strings to add to the fuzzer dictionary. */
38-
String[] tokens();
38+
String[] value();
3939
}

src/main/java/com/code_intelligence/jazzer/junit/FuzzerDictionary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private static Optional<Path> createDictionaryFile(
117117
*/
118118
private static Stream<String> getInlineTokens(List<DictionaryEntries> inline) {
119119
return inline.stream()
120-
.map(DictionaryEntries::tokens)
120+
.map(DictionaryEntries::value)
121121
.flatMap(Arrays::stream)
122122
.map(FuzzerDictionary::escapeForDictionary);
123123
}

0 commit comments

Comments
 (0)