/** * Create a new anticipator with the specified failFast setting. * * @param failFast whether unanticipated exceptions will cause an immediate * junit.framework.Assert#fail(String). See #setFailFast(boolean) * for details. */ public ThrowableAnticipator(boolean failFast) { init(); m_failFast = failFast; }
/** * <p>getTempDir</p> * * @return a {@link java.io.File} object. */ public File getTempDir() { assertInitialized(); return m_tempDir; }
/** * Delete expected files, throwing an AssertionFailedError if any of * the expected files don't exist. */ public void deleteExpected() { deleteExpected(false); }
private File getSnmpRrdDirectory() throws IOException { if (m_snmpDirectory == null) { m_snmpDirectory = m_fileAnticipator.tempDir("snmp"); } return m_snmpDirectory; } }
public static File anticipatePath(FileAnticipator fa, File rootDir, String... pathElements) { File parent = rootDir; assertTrue(pathElements.length > 0); for (String pathElement : pathElements) { parent = fa.expecting(parent, pathElement); } return parent; }
/** {@inheritDoc} * @throws Throwable */ @Override protected void finalize() throws Throwable { tearDown(); super.finalize(); }
private void assertInitialized() { if (!isInitialized()) { throw new IllegalStateException("not initialized"); } }
@Override public void beforeRun() { runLocker.park(); }
public void expectingFileWithPrefix(File parent, String prefix, String... suffixesToExclude) { if (parent == null) { throw new IllegalArgumentException("parent argument cannot be null"); } if (prefix == null) { throw new IllegalArgumentException("prefix argument cannot be null"); } assertInitialized(); internalExpectingFileWithPrefix(parent, prefix, suffixesToExclude); }
private StringBuffer listAnticipated() { return makeList(m_anticipated, "Anticipated but unreceived Throwable: ", "\n"); }
/** * <p>Constructor for FileAnticipator.</p> * * @param initialize a boolean. * @throws java.io.IOException if any. */ public FileAnticipator(boolean initialize) throws IOException { if (initialize) { initialize(); } }
private RrdRepository getRepository() { RrdRepository repo = new RrdRepository(); repo.setRrdBaseDir(m_fileAnticipator.getTempDir()); return repo; }
private File getSnmpRrdDirectory() throws IOException { if (m_snmpDirectory == null) { m_snmpDirectory = m_fileAnticipator.tempDir("snmp"); } return m_snmpDirectory; }
@After public void checkWarnings() throws Throwable { // MockLogAppender.assertNoWarningsOrGreater(); m_fileAnticipator.deleteExpected(); }
public static File anticipatePath(FileAnticipator fa, File rootDir, String... pathElements) { File parent = rootDir; assertTrue(pathElements.length > 0); for (String pathElement : pathElements) { parent = fa.expecting(parent, pathElement); } return parent; }
@Override public int send(List<Argument> arguments) { threadLocker.park(); notificationsSent.incrementAndGet(); return 0; }
/** * Reset the class back to its initial state as if it had just been * instantiated. */ public void reset() { init(); }
private StringBuffer listUnanticipated() { return makeList(m_unanticipated, "Unanticipated Throwable: ", "\n"); }
private File getSnmpRrdDirectory() throws IOException { if (m_snmpDirectory == null) { m_snmpDirectory = m_fileAnticipator.tempDir("snmp"); } return m_snmpDirectory; } }
private File getSnmpRrdDirectory() throws IOException { if (snmpDirectory == null) { snmpDirectory = fileAnticipator.tempDir("snmp"); } return snmpDirectory; } }