HttpJUnitRunner cannot be resolved to a type

Marek S

So I have problem:

HttpJUnitRunner cannot be resolved to a type    TestMain.java    /JerseyWebApp/src/test/java/pl/marek/countriesmapper/fileoperations    line 32    Java Problem

Here is my pom.xml:

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>pl.marek</groupId>
    <artifactId>mapper</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <artifactId>JerseyWebApp</artifactId>
  <packaging>war</packaging>
  <name>JerseyWebApp Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit-dep</artifactId>
        <version>4.11</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-servlet</artifactId>
        <version>9.3.3.v20150827</version>
    </dependency>
    <dependency>
        <groupId>httpunit</groupId>
        <artifactId>httpunit</artifactId>
        <version>1.7</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-server</artifactId>
        <version>9.3.3.v20150827</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.8</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-multipart</artifactId>
        <version>1.8</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>JerseyWebApp</finalName>
  </build>
</project>

And my imports:

import java.io.IOException;
import org.apache.http.*;
import org.apache.http.client.*;
import org.apache.http.client.methods.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.http.impl.client.*;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.runner.RunWith;
import junit.framework.TestCase;

I have an error when I'm trying to do this:

@RunWith(HttpJUnitRunner.class)
public class TestMain extends TestCase {

I tried to find solution in google, I added some more dependencies but still nothing. Somebody have idea what I am doing wrong? Or what I am missing.

Suvitruf - Andrei Apanasik

Hm. HttpJUnitRunner is a part of restfuse. So you should import it:

<dependency>
  <groupId>com.restfuse</groupId>
  <artifactId>com.eclipsesource.restfuse</artifactId>
  <version>1.2.0</version>
</dependency>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related