Java tutorial
/* * [y] hybris Platform * * Copyright (c) 2000-2015 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. */ package com.arvatosystems.us.yaas.api.generated; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.apache.commons.io.IOUtils; import org.glassfish.jersey.server.ResourceConfig; import org.junit.Assert; import org.junit.Test; public final class DefaultObjectidResourceTest extends AbstractResourceTest { /** * Server side root resource /objectid, * evaluated with some default value(s). */ private static final String ROOT_RESOURCE_PATH = "/objectid"; /* get() /objectid/ */ @Test public void testGet() throws IOException { final WebTarget target = getRootTarget(ROOT_RESOURCE_PATH).path(""); final Response response = target.request().get(); Assert.assertNotNull("Response must not be null", response); Assert.assertTrue("Response should have a body", response.hasEntity()); String body = IOUtils.toString((InputStream) response.getEntity()); Assert.assertEquals(39, body.length()); Assert.assertEquals("Response does not have expected response code", Status.OK.getStatusCode(), response.getStatus()); } @Override protected ResourceConfig configureApplication() { final ResourceConfig application = new ResourceConfig(); application.register(DefaultObjectidResource.class); return application; } }