-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathFactoryTest.java
More file actions
42 lines (34 loc) · 1.26 KB
/
FactoryTest.java
File metadata and controls
42 lines (34 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* Copyright (c) restSQL Project Contributors. Licensed under MIT. */
package org.restsql.core;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* @author Mark Sawers
*
*/
public class FactoryTest {
@Test
public void testGetRequestDeserializer() throws SqlResourceException {
String mediaType = "application/xml";
assertEquals(mediaType, Factory.getRequestDeserializer(mediaType).getSupportedMediaType());
mediaType = "application/json";
assertEquals(mediaType, Factory.getRequestDeserializer(mediaType).getSupportedMediaType());
try {
Factory.getRequestDeserializer("bad");
fail("Expected SqlResourceException for bad");
} catch(SqlResourceException expected) {
}
}
@Test
public void testGetResponseSerializer() throws SqlResourceException {
String acceptMediaType = "application/xml";
assertEquals("application/xml", Factory.getResponseSerializer(acceptMediaType).getSupportedMediaType());
acceptMediaType = "application/json";
assertEquals("application/json", Factory.getResponseSerializer(acceptMediaType).getSupportedMediaType());
try {
Factory.getResponseSerializer("bad");
fail("Expected SqlResourceException for bad");
} catch(SqlResourceException expected) {
}
}
}