@Test
public void testDoNotCalculateUnenabledDiskUsage() throws Exception{
FreeStyleProject projectWithoutDiskUsage = j.jenkins.createProject(FreeStyleProject.class, "projectWithoutDiskUsage");
FreeStyleBuild build = projectWithoutDiskUsage.createExecutable();
build.save();
DiskUsageProjectActionFactory.DESCRIPTOR.disableBuildsDiskUsageCalculation();
BuildDiskUsageCalculationThread calculation = AperiodicWork.all().get(BuildDiskUsageCalculationThread.class);
calculation.execute(TaskListener.NULL);
assertEquals("Disk usage for build should not be counted.", 0l, DiskUsageTestUtil.getBuildDiskUsageAction(build).getAllDiskUsage(), 0);
DiskUsageProjectActionFactory.DESCRIPTOR.enableBuildsDiskUsageCalculation();