01: /*
02: * $Id: MainTest.java 6825 2006-04-04 03:00:44Z dfs $
03: *
04: * Copyright 2006 Daniel F. Savarese
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.savarese.org/software/ApacheLicense-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: package org.savarese.barehttp;
20:
21: import java.io.*;
22:
23: import junit.framework.*;
24:
25: /**
26: * Tests the Main class by making use of {@link HTTPServerTest},
27: * calling Main.main to start a server instead of instantiating
28: * HTTPServer.
29: *
30: * @author <a href="http://www.savarese.org/">Daniel F. Savarese</a>
31: */
32: public class MainTest extends HTTPServerTest {
33:
34: public MainTest() throws IOException {
35: server = null;
36: }
37:
38: void startServer() throws IOException {
39: Main.main(new String[] { "0", docroot });
40: server = Main.server;
41: }
42:
43: /**
44: * Tests that an invalid number of arguments doesn't start server.
45: */
46: public void testBadArgs() throws IOException {
47: Main.main(new String[0]);
48: assertNull(Main.server);
49: }
50: }
|