Проблема в том, что Randoop не может генерировать контрольные примеры для абстрактных классов, в данном случае java.util.Calendar.
Вы можете указать в командной строке или в файле списка классов имена классов, расширяющих абстрактный класс. Например, вы можете выполнить Randoop с --classlist = myclasses вместо --testclass = test.ClassA; и в файле myclasses (без расширения имени) введите:
test.ClassA
java.util.GregorianCalendar
Я делаю это, и Randoop генерирует несколько тестов, таких как:
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class RegressionTest1 {
public static boolean debug = false;
@Test
public void test001() throws Throwable {
if (debug) { System.out.format("%n%s%n","RegressionTest1.test001"); }
test.ClassA classA0 = new test.ClassA();
java.util.GregorianCalendar gregorianCalendar2 = new java.util.GregorianCalendar();
java.lang.String str3 = gregorianCalendar2.getCalendarType();
classA0.method("java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"America/Argentina/Cordoba\",offset=-10800000,dstSavings=0,useDaylight=false,transitions=62,lastRule=null],firstDayOfWeek=2,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=158,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=7,HOUR_OF_DAY=5,MINUTE=18,SECOND=8,MILLISECOND=53,ZONE_OFFSET=-10800000,DST_OFFSET=0]", (java.util.Calendar)gregorianCalendar2);
java.util.GregorianCalendar gregorianCalendar6 = new java.util.GregorianCalendar();
int i7 = gregorianCalendar6.getMinimalDaysInFirstWeek();
java.util.Date date8 = gregorianCalendar6.getGregorianChange();
int i10 = gregorianCalendar6.getMaximum(3);
java.util.GregorianCalendar gregorianCalendar11 = new java.util.GregorianCalendar();
int i12 = gregorianCalendar11.getMinimalDaysInFirstWeek();
java.util.Date date13 = gregorianCalendar11.getGregorianChange();
boolean b15 = gregorianCalendar11.isSet(16);
int i17 = gregorianCalendar11.getActualMaximum(9);
gregorianCalendar11.setLenient(false);
int i20 = gregorianCalendar6.compareTo((java.util.Calendar)gregorianCalendar11);
int i21 = gregorianCalendar6.getWeeksInWeekYear();
int i23 = gregorianCalendar6.getGreatestMinimum(10);
classA0.method("", (java.util.Calendar)gregorianCalendar6);
java.util.Calendar calendar26 = null;
classA0.method("java.util.GregorianCalendar[time=1528409887986,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"America/Argentina/Cordoba\",offset=-10800000,dstSavings=0,useDaylight=false,transitions=62,lastRule=null],firstDayOfWeek=2,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=158,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=7,HOUR_OF_DAY=19,MINUTE=18,SECOND=7,MILLISECOND=986,ZONE_OFFSET=-10800000,DST_OFFSET=0]", calendar26);
java.util.GregorianCalendar gregorianCalendar29 = new java.util.GregorianCalendar();
int i30 = gregorianCalendar29.getMinimalDaysInFirstWeek();
java.util.Date date31 = gregorianCalendar29.getGregorianChange();
int i33 = gregorianCalendar29.getMaximum(3);
gregorianCalendar29.setLenient(false);
boolean b36 = gregorianCalendar29.isWeekDateSupported();
classA0.method("java.util.GregorianCalendar[time=1528409888438,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"America/Argentina/Cordoba\",offset=-10800000,dstSavings=0,useDaylight=false,transitions=62,lastRule=null],firstDayOfWeek=2,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=158,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=7,HOUR_OF_DAY=19,MINUTE=18,SECOND=8,MILLISECOND=438,ZONE_OFFSET=-10800000,DST_OFFSET=0]", (java.util.Calendar)gregorianCalendar29);
java.util.GregorianCalendar gregorianCalendar39 = new java.util.GregorianCalendar();
int i40 = gregorianCalendar39.getMinimalDaysInFirstWeek();
java.util.Date date41 = gregorianCalendar39.getGregorianChange();
int i43 = gregorianCalendar39.getMaximum(3);
gregorianCalendar39.setLenient(false);
boolean b46 = gregorianCalendar39.isWeekDateSupported();
java.util.GregorianCalendar gregorianCalendar47 = new java.util.GregorianCalendar();
gregorianCalendar47.setMinimalDaysInFirstWeek(0);
int i51 = gregorianCalendar47.get(10);
int i52 = gregorianCalendar47.getWeeksInWeekYear();
boolean b53 = gregorianCalendar39.after((java.lang.Object)gregorianCalendar47);
gregorianCalendar47.set(1, 30, 10, 3, 5);
java.util.GregorianCalendar gregorianCalendar60 = new java.util.GregorianCalendar();
int i61 = gregorianCalendar60.getMinimalDaysInFirstWeek();
java.util.Date date62 = gregorianCalendar60.getGregorianChange();
gregorianCalendar60.roll(4, false);
java.lang.Object obj66 = null;
boolean b67 = gregorianCalendar60.before(obj66);
gregorianCalendar60.setMinimalDaysInFirstWeek(11);
boolean b70 = gregorianCalendar47.before((java.lang.Object)gregorianCalendar60);
classA0.method("java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"America/Argentina/Cordoba\",offset=-10800000,dstSavings=0,useDaylight=false,transitions=62,lastRule=null],firstDayOfWeek=2,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=158,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=7,HOUR_OF_DAY=5,MINUTE=18,SECOND=8,MILLISECOND=658,ZONE_OFFSET=-10800000,DST_OFFSET=0]", (java.util.Calendar)gregorianCalendar47);
test.Entity entity73 = null;
// The following exception was thrown during execution in test generation
try {
classA0.method2("java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"America/Argentina/Cordoba\",offset=-10800000,dstSavings=0,useDaylight=false,transitions=62,lastRule=null],firstDayOfWeek=2,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=158,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=7,HOUR_OF_DAY=5,MINUTE=18,SECOND=7,MILLISECOND=993,ZONE_OFFSET=-10800000,DST_OFFSET=0]", entity73);
org.junit.Assert.fail("Expected exception of type java.lang.NullPointerException");
} catch (java.lang.NullPointerException e) {
// Expected exception.
if (! e.getClass().getCanonicalName().equals("java.lang.NullPointerException")) {
org.junit.Assert.fail("Expected exception of type java.lang.NullPointerException, got " + e.getClass().getCanonicalName());
}
}