import junit.framework.TestCase;
public class HttpAcceptHeaderProfileTest extends TestCase {
public void testHttpAcceptHeaderProfile() {
HttpAcceptHeaderProfile profile = new HttpAcceptHeaderProfile(
"text/plain", new String[] { "q=0.9", "", " level=1 " });
assertEquals("Invalid profile name.", "accept:text/plain", profile
.getName());
if (profile.getParamNumeric("q", 1.0) != 0.9) {
fail("Invalid qvalue param value.");
}
if ((int) profile.getParamNumeric("level", 2.0) != 1) {
fail("Invalid level param value.");
}
if (profile.getParamNumeric("xxx", 2.0) != 2.0) {
fail("Invalid level param value.");
}
}