File tree Expand file tree Collapse file tree 10 files changed +22
-54
lines changed
app/src/test/java/com/example
testsuite/src/fuzzTest/java/com/example
gradle/src/test/java/com/example
gradle-junit-4-and-5/src/test/java/com/example
gradle-kotlin/src/test/kotlin/com/example
maven/src/test/java/com/example
maven-junit-4-and-5/src/test/java/com/example Expand file tree Collapse file tree 10 files changed +22
-54
lines changed Original file line number Diff line number Diff line change 1
1
package com .example ;
2
2
3
- import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
4
3
import com .code_intelligence .jazzer .junit .FuzzTest ;
4
+ import com .code_intelligence .jazzer .mutation .annotation .NotNull ;
5
+
5
6
import org .junit .jupiter .api .Test ;
6
7
7
8
public class TestCases {
@@ -20,11 +21,8 @@ public void remoteCodeTest() {
20
21
}
21
22
22
23
@ FuzzTest
23
- void remoteCodeFuzzTest (FuzzedDataProvider data ) {
24
+ void remoteCodeFuzzTest (int a , @ NotNull String b ) {
24
25
// Fuzz test that finds RCE
25
- int a = data .consumeInt ();
26
- String b = data .consumeRemainingAsString ();
27
-
28
26
RemoteCodeExecution remoteCode = new RemoteCodeExecution (a );
29
27
remoteCode .trigger (b );
30
28
}
Original file line number Diff line number Diff line change 1
1
package com .example ;
2
2
3
- import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
4
3
import com .code_intelligence .jazzer .junit .FuzzTest ;
5
4
import org .junit .jupiter .api .Test ;
6
5
7
6
public class OutOfBoundsTestCase {
8
7
@ FuzzTest
9
- void fuzzTest (FuzzedDataProvider data ) {
8
+ void fuzzTest (int a ) {
10
9
// Triggers array out of bounds exception
11
- int a = data .consumeInt ();
12
-
13
10
OutOfBounds outOfBounds = new OutOfBounds ();
14
11
outOfBounds .trigger (a );
15
12
}
Original file line number Diff line number Diff line change 1
1
package com .example ;
2
2
3
- import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
4
3
import com .code_intelligence .jazzer .junit .FuzzTest ;
5
- import com .example . RemoteCodeExecution ;
4
+ import com .code_intelligence . jazzer . mutation . annotation . NotNull ;
6
5
7
6
public class RCEFuzzTestCase {
8
7
@ FuzzTest
9
- void fuzzTestTrigger (FuzzedDataProvider data ) {
10
- // Trigger remote code execution
11
- int a = data .consumeInt ();
12
- String b = data .consumeRemainingAsString ();
13
-
8
+ void fuzzTestTrigger (int a , @ NotNull String b ) {
14
9
RemoteCodeExecution rce = new RemoteCodeExecution (a );
15
10
rce .trigger (b );
16
11
}
17
12
18
13
@ FuzzTest
19
- void fuzzTestDontTrigger (FuzzedDataProvider data ) {
14
+ void fuzzTestDontTrigger (@ NotNull String b ) {
20
15
// Don't trigger remote code execution
21
16
// by using the overloaded constructor
22
- String b = data .consumeRemainingAsString ();
23
-
24
17
RemoteCodeExecution rce = new RemoteCodeExecution ();
25
18
rce .trigger (b );
26
19
}
Original file line number Diff line number Diff line change 1
- import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
2
1
import com .code_intelligence .jazzer .junit .FuzzTest ;
3
2
import util .NegativeArraySize ;
4
3
5
4
public class NegativeArraySizeFuzzTest {
6
5
7
6
@ FuzzTest
8
- void fuzzTest (FuzzedDataProvider data ) {
7
+ void fuzzTest (int a ) {
9
8
// Trigger Negative Array Size Exception
10
- NegativeArraySize .negative (data . consumeInt () );
9
+ NegativeArraySize .negative (a );
11
10
}
12
11
}
Original file line number Diff line number Diff line change 1
1
package util ;
2
2
3
- import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
4
3
import com .code_intelligence .jazzer .junit .FuzzTest ;
4
+ import com .code_intelligence .jazzer .mutation .annotation .NotNull ;
5
5
import org .junit .jupiter .api .Test ;
6
6
7
7
import static org .junit .jupiter .api .Assertions .assertEquals ;
@@ -15,8 +15,8 @@ public void joinTest() throws Exception {
15
15
}
16
16
17
17
@ FuzzTest
18
- void joinFuzzTest (FuzzedDataProvider data ) throws Exception {
18
+ void joinFuzzTest (@ NotNull String a ) throws Exception {
19
19
// Trigger Exception
20
- Util .join (data . consumeRemainingAsString () );
20
+ Util .join (a );
21
21
}
22
22
}
Original file line number Diff line number Diff line change 1
1
package com .example ;
2
2
3
- import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
4
3
import com .code_intelligence .jazzer .junit .FuzzTest ;
4
+ import com .code_intelligence .jazzer .mutation .annotation .NotNull ;
5
5
6
6
class ExploreFuzzTest {
7
7
@ FuzzTest
8
- void myFuzzTest (FuzzedDataProvider data ) {
9
- int a = data .consumeInt ();
10
- int b = data .consumeInt ();
11
- String c = data .consumeRemainingAsString ();
12
-
8
+ void myFuzzTest (int a , int b , @ NotNull String c ) {
13
9
ExploreMe ex = new ExploreMe (a );
14
10
ex .exploreMe (b , c );
15
11
}
Original file line number Diff line number Diff line change 1
1
package com.example
2
2
3
- import com.code_intelligence.jazzer.api.FuzzedDataProvider
4
3
import com.code_intelligence.jazzer.junit.FuzzTest
4
+ import com.code_intelligence.jazzer.mutation.annotation.NotNull
5
5
6
6
class FuzzTestCase {
7
7
@FuzzTest
8
- fun myFuzzTest (data : FuzzedDataProvider ) {
9
- val a: Int = data.consumeInt()
10
- val b: Int = data.consumeInt()
11
- val c: String = data.consumeRemainingAsString()
8
+ fun myFuzzTest (a : Int , b : Int , @NotNull c : String ) {
12
9
val ex = ExploreMe (a)
13
10
ex.exploreMe(b, c)
14
11
}
Original file line number Diff line number Diff line change 1
1
package com .example ;
2
2
3
- import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
4
3
import com .code_intelligence .jazzer .junit .FuzzTest ;
4
+ import com .code_intelligence .jazzer .mutation .annotation .NotNull ;
5
5
6
6
public class FuzzTestCase {
7
7
@ FuzzTest
8
- void myFuzzTest (FuzzedDataProvider data ) {
9
- int a = data .consumeInt ();
10
- int b = data .consumeInt ();
11
- String c = data .consumeRemainingAsString ();
12
-
8
+ void myFuzzTest (int a , int b , @ NotNull String c ) {
13
9
ExploreMe ex = new ExploreMe (a );
14
10
ex .exploreMe (b , c );
15
11
}
Original file line number Diff line number Diff line change 1
1
package com .example ;
2
2
3
- import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
4
3
import com .code_intelligence .jazzer .junit .FuzzTest ;
4
+ import com .code_intelligence .jazzer .mutation .annotation .NotNull ;
5
5
6
6
class ExploreFuzzTest {
7
7
@ FuzzTest
8
- void myFuzzTest (FuzzedDataProvider data ) {
9
- int a = data .consumeInt ();
10
- int b = data .consumeInt ();
11
- String c = data .consumeRemainingAsString ();
12
-
8
+ void myFuzzTest (int a , int b , @ NotNull String c ) {
13
9
ExploreMe ex = new ExploreMe (a );
14
10
ex .exploreMe (b , c );
15
11
}
Original file line number Diff line number Diff line change 1
1
package com .example ;
2
2
3
- import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
4
3
import com .code_intelligence .jazzer .junit .FuzzTest ;
4
+ import com .code_intelligence .jazzer .mutation .annotation .NotNull ;
5
5
6
6
public class FuzzTestCase {
7
7
@ FuzzTest
8
- void myFuzzTest (FuzzedDataProvider data ) {
9
- int a = data .consumeInt ();
10
- int b = data .consumeInt ();
11
- String c = data .consumeRemainingAsString ();
12
-
8
+ void myFuzzTest (int a , int b , @ NotNull String c ) {
13
9
ExploreMe ex = new ExploreMe (a );
14
10
ex .exploreMe (b , c );
15
11
}
You can’t perform that action at this time.
0 commit comments