samples/aserverinfo/test/org/apidesign/aserverinfo/AServerInfoTest.java
changeset 292 60bb8519cb2d
parent 291 9cbb8364c4ae
child 293 4feb55fa3c91
     1.1 --- a/samples/aserverinfo/test/org/apidesign/aserverinfo/AServerInfoTest.java	Sun Nov 09 16:20:01 2008 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,85 +0,0 @@
     1.4 -package org.apidesign.aserverinfo;
     1.5 -
     1.6 -import java.net.MalformedURLException;
     1.7 -import java.net.URL;
     1.8 -import org.junit.After;
     1.9 -import org.junit.Before;
    1.10 -import org.junit.Test;
    1.11 -import static org.junit.Assert.*;
    1.12 -import org.openide.util.Exceptions;
    1.13 -
    1.14 -public class AServerInfoTest {
    1.15 -
    1.16 -    public AServerInfoTest() {
    1.17 -    }
    1.18 -
    1.19 -    @Before
    1.20 -    public void setUp() {
    1.21 -    }
    1.22 -
    1.23 -    @After
    1.24 -    public void tearDown() {
    1.25 -    }
    1.26 -
    1.27 -    @Test
    1.28 -    public void showUseOfCumulativeFactory() throws Exception {
    1.29 -        Prov p = new Prov();
    1.30 -        AServerInfo.NameProvider np = p;
    1.31 -        AServerInfo.URLProvider up = p;
    1.32 -        AServerInfo.ResetHandler res = p;
    1.33 -        AServerInfo inf;
    1.34 -        
    1.35 -        // BEGIN: aserverinfo.cumulative.creation
    1.36 -        inf = AServerInfo.empty().nameProvider(np).urlProvider(up).reset(res);
    1.37 -        // END: aserverinfo.cumulative.creation
    1.38 -        
    1.39 -        assertEquals("API Design Server", inf.getName());
    1.40 -        assertEquals("http://www.apidesign.org", inf.getURL().toExternalForm());
    1.41 -        inf.reset();
    1.42 -        assertEquals("Once reset", 1, p.resets);
    1.43 -        
    1.44 -    }
    1.45 -    
    1.46 -    @Test
    1.47 -    public void showVerboseUseOfCumulativeFactory() throws Exception {
    1.48 -        Prov prov = new Prov();
    1.49 -        AServerInfo info;
    1.50 -        
    1.51 -        // BEGIN: aserverinfo.cumulative.creation.verbose
    1.52 -        AServerInfo empty = AServerInfo.empty();
    1.53 -        AServerInfo name = empty.nameProvider(prov);
    1.54 -        AServerInfo urlAndName = name.urlProvider(prov);
    1.55 -        info = urlAndName.reset(prov);
    1.56 -        // END: aserverinfo.cumulative.creation.verbose
    1.57 -        
    1.58 -        assertEquals("API Design Server", info.getName());
    1.59 -        assertEquals("http://www.apidesign.org", info.getURL().toExternalForm());
    1.60 -        info.reset();
    1.61 -        assertEquals("Once reset", 1, prov.resets);
    1.62 -        
    1.63 -    }
    1.64 -    
    1.65 -    
    1.66 -    private static class Prov implements AServerInfo.NameProvider, AServerInfo.URLProvider, AServerInfo.ResetHandler {
    1.67 -        int resets;
    1.68 -
    1.69 -        public String getName() {
    1.70 -            return "API Design Server";
    1.71 -        }
    1.72 -
    1.73 -        public URL getURL() {
    1.74 -            try {
    1.75 -                return new URL("http://www.apidesign.org");
    1.76 -            } catch (MalformedURLException ex) {
    1.77 -                Exceptions.printStackTrace(ex);
    1.78 -                return null;
    1.79 -            }
    1.80 -        }
    1.81 -
    1.82 -        public void reset() {
    1.83 -            resets++;
    1.84 -        }
    1.85 -
    1.86 -    }
    1.87 -        
    1.88 -}
    1.89 \ No newline at end of file