1   package org.apache.commons.logging.impl;
2   
3   import java.io.ByteArrayOutputStream;
4   import java.io.IOException;
5   import java.io.ObjectOutputStream;
6   
7   import junit.framework.TestCase;
8   
9   import org.apache.commons.logging.Log;
10  import org.apache.commons.logging.LogFactory;
11  
12  public class SerializationTest extends TestCase {
13  
14    ObjectOutputStream oos;
15    
16    public SerializationTest(String name) {
17      super(name);
18    }
19  
20    protected void setUp() throws Exception {
21      ByteArrayOutputStream baos = new ByteArrayOutputStream();
22      oos = new ObjectOutputStream(baos);
23      super.setUp();
24    }
25  
26    protected void tearDown() throws Exception {
27      super.tearDown();
28      oos.close();
29    }
30  
31    
32    public void testSmokeSimple() throws IOException {
33      Log log = LogFactory.getLog("testing");
34      oos.writeObject(log);
35    }
36    
37    public void testSmokeLocationAware() throws IOException {
38      SLF4JLocationAwareLog log = new SLF4JLocationAwareLog(null);
39      oos.writeObject(log);
40    }
41  }