1 // Copyright 2021 Code Intelligence GmbH 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package com.code_intelligence.jazzer.autofuzz; 16 17 import static com.code_intelligence.jazzer.autofuzz.TestHelpers.consumeTestCase; 18 19 import com.code_intelligence.jazzer.autofuzz.testdata.EmployeeWithSetters; 20 import java.util.Arrays; 21 import org.junit.Test; 22 23 public class SettersTest { 24 @Test testEmptyConstructorWithSetters()25 public void testEmptyConstructorWithSetters() { 26 EmployeeWithSetters employee = new EmployeeWithSetters(); 27 employee.setFirstName("foo"); 28 employee.setAge(26); 29 30 consumeTestCase(employee, 31 "((java.util.function.Supplier<com.code_intelligence.jazzer.autofuzz.testdata.EmployeeWithSetters>) (() -> {com.code_intelligence.jazzer.autofuzz.testdata.EmployeeWithSetters autofuzzVariable0 = new com.code_intelligence.jazzer.autofuzz.testdata.EmployeeWithSetters(); autofuzzVariable0.setFirstName(\"foo\"); autofuzzVariable0.setAge(26); return autofuzzVariable0;})).get()", 32 Arrays.asList((byte) 1, // do not return null for EmployeeWithSetters 33 0, // pick first constructor 34 2, // pick two setters 35 1, // pick second setter 36 0, // pick first setter 37 (byte) 1, // do not return null for String 38 6, // remaining bytes 39 "foo", // setFirstName 40 26 // setAge 41 )); 42 } 43 } 44