1 package org.apidesign.exceptions.trycatchredo;
4 import java.awt.EventQueue;
5 import java.awt.event.ActionEvent;
7 import javax.swing.Action;
8 import org.junit.After;
9 import org.junit.Before;
10 import org.junit.Test;
11 import static org.junit.Assert.*;
15 * @author Jaroslav Tulach <jtulach@netbeans.org>
17 public class IOManagerTest {
19 public IOManagerTest() {
24 MemoryURL.initialize();
28 public void tearDown() {
32 public void simpleWrite() throws Exception {
33 URL u = new URL("memory://simpleWrite.txt");
34 MemoryURL.registerURL(u.toExternalForm(), "", null);
35 final Action a = IOManager.createSaveAction(u, "Ahoj");
36 EventQueue.invokeAndWait(new Runnable() {
38 a.actionPerformed(new ActionEvent(this, 0, ""));
41 byte[] out = MemoryURL.getOutputForURL(u.toExternalForm());
42 assertEquals("Four bytes", 4, out.length);