review2: Note about Tune and DVB Central. Finished example with AServerInfo
1 package org.apidesign.aserverinfo;
3 import java.net.MalformedURLException;
5 import org.junit.After;
6 import org.junit.Before;
8 import static org.junit.Assert.*;
9 import org.openide.util.Exceptions;
11 public class AServerInfoTest {
13 public AServerInfoTest() {
21 public void tearDown() {
25 public void showUseOfCumulativeFactory() throws Exception {
26 class Prov implements AServerInfo.NameProvider, AServerInfo.URLProvider, AServerInfo.ResetHandler {
29 public String getName() {
30 return "API Design Server";
35 return new URL("http://www.apidesign.org");
36 } catch (MalformedURLException ex) {
37 Exceptions.printStackTrace(ex);
48 Prov prov = new Prov();
51 // BEGIN: aserverinfo.cumulative.creation
52 info = AServerInfo.empty().nameProvider(prov).urlProvider(prov).reset(prov);
53 // END: aserverinfo.cumulative.creation
55 assertEquals("API Design Server", info.getName());
56 assertEquals("http://www.apidesign.org", info.getURL().toExternalForm());
58 assertEquals("Once reset", 1, prov.resets);