@Override protected void setUp() { //_oldDebugState = Debug.setEnabled(true); _oldDebugState = Debug.setEnabled(false); }
@Override protected void setUp() throws Exception { _lastDebugState = Debug.setEnabled(true); }
@Override protected void tearDown() { Debug.setEnabled(_oldDebugState); }
@Override protected void tearDown() throws Exception { Debug.setEnabled(_lastDebugState); }
@Override protected void tearDown() { Debug.setEnabled(_oldDebugState); }
private static boolean isDebugClassTestable() { boolean oldDebugState = Debug.isEnabled(); Debug.setEnabled(true); boolean newDebugState = Debug.isEnabled(); Debug.setEnabled(oldDebugState); return newDebugState; }
Debug.setEnabled(debugEnabled); if (debugEnabled) { JAI.getDefaultInstance().setImagingListener(new ImagingListener() {
public void testAssertNotNull() { Debug.setEnabled(false); try { Debug.assertNotNull(new Object()); } catch (AssertionFailure e) { fail("no AssertionFailure expected"); } try { Debug.assertNotNull(null); } catch (AssertionFailure e) { fail("no AssertionFailure expected"); } Debug.setEnabled(true); Debug.setWriter(new java.io.StringWriter()); try { Debug.assertNotNull(new Object()); } catch (AssertionFailure e) { fail("no AssertionFailure expected"); } try { Debug.assertNotNull(null); fail("AssertionFailure expected"); } catch (AssertionFailure e) { } }
public void testAssertWidthoutMessage() { Debug.setEnabled(false); try { Debug.assertTrue(true); } catch (AssertionFailure e) { fail("no AssertionFailure expected"); } try { Debug.assertTrue(false); } catch (AssertionFailure e) { fail("no AssertionFailure expected"); } Debug.setEnabled(true); java.io.StringWriter sw = new java.io.StringWriter(); Debug.setWriter(sw); try { Debug.assertTrue(true); } catch (AssertionFailure e) { fail("no AssertionFailure expected"); } try { Debug.assertTrue(false); fail("AssertionFailure expected"); } catch (AssertionFailure e) { } String assertionFailureMsg = sw.getBuffer().toString(); String expectedContent = Debug.class.getName(); assertEquals(true, assertionFailureMsg.indexOf(expectedContent) >= 0); }
public void testAssertWidtMessage() { Debug.setEnabled(false); try { Debug.assertTrue(true, "ErrorMessage"); } catch (AssertionFailure e) { fail("no AssertionFailure expected"); } try { Debug.assertTrue(false, "ErrorMessage"); } catch (AssertionFailure e) { fail("no AssertionFailure expected"); } Debug.setEnabled(true); java.io.StringWriter sw = new java.io.StringWriter(); Debug.setWriter(sw); try { Debug.assertTrue(true, "ErrorMessage"); } catch (AssertionFailure e) { fail("no AssertionFailure expected"); } try { Debug.assertTrue(false, "ErrorMessage"); fail("AssertionFailure expected"); } catch (AssertionFailure e) { assertEquals("ErrorMessage", e.getMessage()); } String assertionFailureMsg = sw.getBuffer().toString(); String expectedContent = Debug.class.getName(); assertEquals(true, assertionFailureMsg.indexOf(expectedContent) >= 0); }
public static void main(String[] args) throws Exception { String sourceDirFile = args[0]; String regionWktFile = args[1]; String binnerConfigFile = args[2]; String[] outputterConfigFiles = new String[args.length - 3]; System.arraycopy(args, 3, outputterConfigFiles, 0, outputterConfigFiles.length); File[] sourceFiles = new File(sourceDirFile).listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".N1"); } }); String regionWkt = FileUtils.readText(new File(regionWktFile)); BinningConfig binningConfig = BinningConfig.fromXml(FileUtils.readText(new File(binnerConfigFile))); Debug.setEnabled(true); StopWatch stopWatch = new StopWatch(); stopWatch.start(); BinningContext binningContext = binningConfig.createBinningContext(null, null, null); // Step 1: Spatial binning - creates time-series of spatial bins for each bin ID ordered by ID. The tree map structure is <ID, time-series> SortedMap<Long, List<SpatialBin>> spatialBinMap = doSpatialBinning(binningContext, sourceFiles); // Step 2: Temporal binning - creates a list of temporal bins, sorted by bin ID List<TemporalBin> temporalBins = doTemporalBinning(binningContext, spatialBinMap); // Step 3: Formatting for (String outputterConfigFile : outputterConfigFiles) { FormatterConfig formatterConfig = FormatterConfig.fromXml(FileUtils.readText(new File(outputterConfigFile))); doOutputting(regionWkt, formatterConfig, binningContext, temporalBins); } stopWatch.stopAndTrace(String.format("Total time for binning %d product(s)", sourceFiles.length)); }
i++; } else if (isOption(args, i, 'd', "debug")) { Debug.setEnabled(true); } else if (isOption(args, i, 'f', "format")) { _formatExt = getOptionArg(args, i);
public void testAssertNotNullOrEmpty() { Debug.setEnabled(false); try { Debug.assertNotNullOrEmpty(null); Debug.setEnabled(true); Debug.setWriter(new java.io.StringWriter()); try {
public void testRawAgainstOptimized(FXYSum fxyRaw, FXYSum fxyOpt) { final int m = 100; double[][] data = new double[m][3]; double x, y, z; for (int i = 0; i < m; i++) { x = Math.PI * random(-0.5, +0.5); y = Math.PI * random(-0.5, +0.5); z = Math.sin((x * y) / 4.0 + (x + y) / 2.0); data[i][0] = x; data[i][1] = y; data[i][2] = z; } fxyRaw.approximate(data, null); fxyOpt.approximate(data, null); final boolean oldState = Debug.setEnabled(true); try { assertEquals(fxyRaw.getRootMeanSquareError(), fxyOpt.getRootMeanSquareError(), EPS); double zRaw, zOpt; for (int i = 0; i < 10; i++) { x = Math.PI * random(-0.5, +0.5); y = Math.PI * random(-0.5, +0.5); zRaw = fxyRaw.computeZ(x, y); zOpt = fxyOpt.computeZ(x, y); assertEquals(zRaw, zOpt, EPS); } } finally { Debug.setEnabled(oldState); } }
debugEnabled = bV; if (debugEnabled) { Debug.setEnabled(true);