1 package org.apache.turbine.services.mimetype;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Locale;
23
24 import org.apache.fulcrum.mimetype.MimeTypeService;
25 import org.apache.turbine.services.ServiceManager;
26 import org.apache.turbine.services.TurbineServices;
27 import org.apache.turbine.test.BaseTestCase;
28 import org.apache.turbine.util.TurbineConfig;
29 import org.junit.AfterClass;
30 import org.junit.BeforeClass;
31 import org.junit.Test;
32
33 import static org.junit.Assert.*;
34
35
36
37
38
39
40
41
42 public class FulcrumMimetypeComponentTest extends BaseTestCase
43 {
44 private static TurbineConfig tc = null;
45
46 @Test public void testComponent() throws Exception
47 {
48 ServiceManager serviceManager = TurbineServices.getInstance();
49 MimeTypeService mimeTypeService = (MimeTypeService) serviceManager.getService(MimeTypeService.class.getName());
50
51 Locale locale = new Locale("en", "US");
52 String s = mimeTypeService.getCharSet(locale);
53 assertEquals("ISO-8859-1", s);
54 }
55
56 @BeforeClass
57 public static void setUp() throws Exception
58 {
59 tc =
60 new TurbineConfig(
61 ".",
62 "/conf/test/TestFulcrumComponents.properties");
63 tc.initialize();
64 }
65 @AfterClass
66 public static void tearDown() throws Exception
67 {
68 if (tc != null)
69 {
70 tc.dispose();
71 }
72 }
73 }