1 | /**************************************************************** |
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one * |
---|
3 | * or more contributor license agreements. See the NOTICE file * |
---|
4 | * distributed with this work for additional information * |
---|
5 | * regarding copyright ownership. The ASF licenses this file * |
---|
6 | * to you under the Apache License, Version 2.0 (the * |
---|
7 | * "License"); you may not use this file except in compliance * |
---|
8 | * with the License. You may obtain a copy of the License at * |
---|
9 | * * |
---|
10 | * http://www.apache.org/licenses/LICENSE-2.0 * |
---|
11 | * * |
---|
12 | * Unless required by applicable law or agreed to in writing, * |
---|
13 | * software distributed under the License is distributed on an * |
---|
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * |
---|
15 | * KIND, either express or implied. See the License for the * |
---|
16 | * specific language governing permissions and limitations * |
---|
17 | * under the License. * |
---|
18 | ****************************************************************/ |
---|
19 | |
---|
20 | package org.apache.james.mime4j; |
---|
21 | |
---|
22 | import java.io.BufferedInputStream; |
---|
23 | import java.io.IOException; |
---|
24 | import java.io.InputStream; |
---|
25 | |
---|
26 | import org.apache.commons.io.IOUtils; |
---|
27 | |
---|
28 | public class TestUtil { |
---|
29 | public static final String[] TEST_MESSAGES = new String[] { |
---|
30 | "2002_06_12_doublebound", |
---|
31 | "ak-0696", |
---|
32 | "bluedot-postcard", |
---|
33 | "bluedot-simple", |
---|
34 | "double-bound-with-embedded", |
---|
35 | "double-bound", |
---|
36 | "dup-names", |
---|
37 | "frag", |
---|
38 | "german", |
---|
39 | "hdr-fakeout", |
---|
40 | "multi-2evil", |
---|
41 | "multi-2gifs", |
---|
42 | "multi-clen", |
---|
43 | "multi-digest", |
---|
44 | "multi-frag", |
---|
45 | "multi-igor", |
---|
46 | "multi-igor2", |
---|
47 | "multi-nested", |
---|
48 | "multi-nested2", |
---|
49 | "multi-nested3", |
---|
50 | "multi-simple", |
---|
51 | "multi-weirdspace", |
---|
52 | "re-fwd", |
---|
53 | "russian", |
---|
54 | "simple", |
---|
55 | "uu-junk-target", |
---|
56 | "uu-junk", |
---|
57 | "uu-zeegee" |
---|
58 | }; |
---|
59 | |
---|
60 | public static String readResource(String resource, String charset) |
---|
61 | throws IOException { |
---|
62 | |
---|
63 | return IOUtils.toString(readResourceAsStream(resource), charset); |
---|
64 | } |
---|
65 | |
---|
66 | public static InputStream readResourceAsStream(String resource) |
---|
67 | throws IOException { |
---|
68 | |
---|
69 | return new BufferedInputStream( |
---|
70 | TestUtil.class.getResource(resource).openStream()); |
---|
71 | } |
---|
72 | |
---|
73 | } |
---|