import com.blahblah.arquilliantest.*; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.web.client.RestTemplate; import java.net.URL; import static org.junit.Assert.assertEquals; @RunWith(Arquillian.class) //@ContextConfiguration(classes = {RESTClientConfig.class}) public class SimpleControllerTest { // String Templates private static final String URL_IS = "Testing: %s\n"; /** * Arquillian is responsible for setting up the server to test against and so is also the * custodian of base URL/Port information. */ @ArquillianResource private URL baseUrl; /** * We'll use RestTemplate to make http requests. */ // @Autowired // private RestTemplateBean restTemplateBean; @Deployment(testable = false) public static WebArchive createDeployment() { WebArchive war = ShrinkWrap.create(WebArchive.class) .addPackage("com.blahblah.arquillian") .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); System.out.println(war.toString(true)); return war; } @Test public void testReturnPathElem() { String pathElem = "aPathElemHuzzah"; String path = baseUrl + pathElem; System.out.printf(URL_IS, path); // String result = restTemplateBean.getRestTemplate().getForObject(path, String.class); String result = new RestTemplate().getForObject(path, String.class); assertEquals(result, pathElem); } }