2
* Copyright 2005-2012 Restlet S.A.S.
4
* The contents of this file are subject to the terms of one of the following
5
* open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
6
* 1.0 (the "Licenses"). You can select the license that you prefer but you may
7
* not use this file except in compliance with one of these Licenses.
9
* You can obtain a copy of the Apache 2.0 license at
10
* http://www.opensource.org/licenses/apache-2.0
12
* You can obtain a copy of the LGPL 3.0 license at
13
* http://www.opensource.org/licenses/lgpl-3.0
15
* You can obtain a copy of the LGPL 2.1 license at
16
* http://www.opensource.org/licenses/lgpl-2.1
18
* You can obtain a copy of the CDDL 1.0 license at
19
* http://www.opensource.org/licenses/cddl1
21
* You can obtain a copy of the EPL 1.0 license at
22
* http://www.opensource.org/licenses/eclipse-1.0
24
* See the Licenses for the specific language governing permissions and
25
* limitations under the Licenses.
27
* Alternatively, you can obtain a royalty free commercial license with less
28
* limitations, transferable or non-transferable, directly at
29
* http://www.restlet.com/products/restlet-framework
31
* Restlet is a registered trademark of Restlet S.A.S.
34
package org.restlet.test.resource;
36
import java.io.IOException;
38
import org.restlet.data.MediaType;
39
import org.restlet.representation.Representation;
40
import org.restlet.resource.ClientResource;
41
import org.restlet.resource.Finder;
42
import org.restlet.resource.ResourceException;
43
import org.restlet.test.RestletTestCase;
46
* Test the annotated resources, client and server sides.
48
* @author Jerome Louvel
50
public class AnnotatedResource2TestCase extends RestletTestCase {
52
private ClientResource clientResource;
54
protected void setUp() throws Exception {
56
Finder finder = new Finder();
57
finder.setTargetClass(MyResource2.class);
59
this.clientResource = new ClientResource("http://local");
60
this.clientResource.setNext(finder);
64
protected void tearDown() throws Exception {
65
clientResource = null;
69
public void testGet() throws IOException, ResourceException {
70
Representation result = clientResource.get(MediaType.APPLICATION_ATOM);
71
assertNotNull(result);
72
assertEquals("<content/>", result.getText());
73
assertEquals(MediaType.TEXT_XML, result.getMediaType());