HttpUnit : テストコードとpom.xml

ステータスコード200が返ってくるかどうかのテスト。
SAXException SAX[Simple API for XML]に関する例外
MalformedURLException 無効な書式のURLが発生したらスローされる
(有効なプロトコルが指定されていないなど)

@Test
	public void レスポンスコード取得() throws MalformedURLException,
			IOException, SAXException {
		String url = "http://localhost:8080" + "/HttpUnitTest/";
		WebRequest req = new GetMethodWebRequest(url);
		WebConversation wc = new WebConversation();
		WebResponse res = wc.getResponse(req);

		assertEquals(200, res.getResponseCode());
	}


↓使用しているプラグインなど(pom.xmlの一部)

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.6</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>httpunit</groupId>
			<artifactId>httpunit</artifactId>
			<version>1.6.2</version>
		</dependency>
	</dependencies>
	<build>
		<finalName>HttpUnitTest</finalName>
		<plugins>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
				<version>6.1.4</version>
			</plugin>
			<plugin>
				<artifactId>maven-eclipse-plugin</artifactId>
				<configuration>
					<wtpversion>2.0</wtpversion>
					<downloadSources>true</downloadSources>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<inherited>true</inherited>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
					<optimise>true</optimise>
					<debug>true</debug>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>

Maven・・・あなたが神か。
便利です。