### Question:
Q2 implements FileFilter, Runnable { protected Document encrypt (Document doc) throws GeneralSecurityException, IOException { ByteArrayOutputStream os = new ByteArrayOutputStream (); OutputStreamWriter writer = new OutputStreamWriter (os); XMLOutputter out = new XMLOutputter (Format.getPrettyFormat()); out.output(doc, writer); writer.close (); byte[] crypt = dodes (os.toByteArray(), Cipher.ENCRYPT_MODE); Document secureDoc = new Document (); Element root = new Element (PROTECTED_QBEAN); secureDoc.setRootElement (root); Element secureData = new Element ("data"); root.addContent (secureData); secureData.setText ( ISOUtil.hexString (crypt) ); return secureDoc; } Q2(String[] args, BundleContext bundleContext);  Q2();  Q2(String deployDir);  Q2(String[] args); void start(); void stop(); void run(); void shutdown(); boolean running(); boolean ready(); boolean ready(long millis); void shutdown(boolean join); QClassLoader getLoader(); QFactory getFactory(); String[] getCommandLineArgs(); boolean accept(File f); File getDeployDir(); String getWatchServiceClassname(); static Q2 getQ2(); static Q2 getQ2(long timeout); void relax(long sleep); void relax(); Log getLog(); MBeanServer getMBeanServer(); long getUptime(); void displayVersion(); UUID getInstanceId(); static String getVersionString(); void deployElement(Element e, String fileName, boolean encrypt, boolean isTransient); Framework getOSGIFramework(); static void main(String[] args); static String getVersion(); static String getRevision(); static String getBranch(); static String getBuildTimestamp(); static String getRelease(); static String getAppVersionString(); boolean isDisableDynamicClassloader(); static final String DEFAULT_DEPLOY_DIR; static final String JMX_NAME; static final String LOGGER_NAME; static final String REALM; static final String LOGGER_CONFIG; static final String QBEAN_NAME; static final String Q2_CLASS_LOADER; static final String DUPLICATE_EXTENSION; static final String ERROR_EXTENSION; static final String ENV_EXTENSION; static final String LICENSEE; static final byte[] PUBKEYHASH; static final String PROTECTED_QBEAN; static final int SCAN_INTERVAL; static final long SHUTDOWN_TIMEOUT; }### Answer:
@Disabled @Test public void testEncryptThrowsIllegalStateException() throws Throwable { try { m_q2.encrypt(new Document()); fail("Expected IllegalStateException to be thrown"); } catch (IllegalStateException ex) { assertEquals("Root element not set", ex.getMessage(), "ex.getMessage()"); } }