1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.neo4j.server.rest.repr;
21
22 import org.junit.Test;
23
24 import javax.ws.rs.core.MediaType;
25
26 import static org.junit.Assert.fail;
27
28 public class RepresentationFormatRepositoryTest
29 {
30 private final RepresentationFormatRepository repository = new RepresentationFormatRepository(
31 null );
32
33 @Test
34 public void canProvideJsonFormat() throws Exception
35 {
36 repository.inputFormat( MediaType.valueOf( "application/json" ) );
37 }
38
39 @Test
40 public void canProvideUTF8EncodedJsonFormat() throws Exception
41 {
42 repository.inputFormat( MediaType.valueOf( "application/json;charset=UTF-8" ) );
43 }
44
45 @Test( expected = MediaTypeNotSupportedException.class )
46 public void canNotGetInputFormatBasedOnWildcardMediaType() throws Exception
47 {
48 InputFormat format = repository.inputFormat( MediaType.WILDCARD_TYPE );
49 format.readValue( "foo" );
50 fail( "Got InputFormat based on wild card type: " + format );
51 }
52 }