01: package de.java2html.converter.test;
02:
03: import junit.framework.TestCase;
04:
05: import de.java2html.converter.IJavaSourceConverter;
06: import de.java2html.converter.JavaSourceConverterProvider;
07:
08: /**
09: * @author Markus Gebhard
10: */
11: public class JavaSourceConverterProviderTest extends TestCase {
12:
13: public void testGetConverterNames() {
14: final String[] names = JavaSourceConverterProvider
15: .getAllConverterNames();
16: assertNotNull(names);
17: assertTrue(2 < names.length);
18: for (int i = 0; i < names.length; ++i) {
19: assertNotNull(names[i]);
20: }
21: }
22:
23: public void testGetConverterPrintNames() {
24: final String[] names = JavaSourceConverterProvider
25: .getAllConverterPrintNames();
26: assertNotNull(names);
27: assertTrue(2 < names.length);
28: for (int i = 0; i < names.length; ++i) {
29: assertNotNull(names[i]);
30: }
31: }
32:
33: public void testGetConvertersByName() {
34: String[] names = JavaSourceConverterProvider
35: .getAllConverterNames();
36: for (int i = 0; i < names.length; i++) {
37: final IJavaSourceConverter converter = JavaSourceConverterProvider
38: .getJavaSourceConverterByName(names[i]);
39: assertNotNull(converter);
40: assertTrue(names[i].equalsIgnoreCase(converter
41: .getMetaData().getName()));
42: }
43: }
44:
45: public void testGetConvertersByNameIgnoresCase() {
46: String[] names = JavaSourceConverterProvider
47: .getAllConverterNames();
48: for (int i = 0; i < names.length; i++) {
49: final IJavaSourceConverter converter1 = JavaSourceConverterProvider
50: .getJavaSourceConverterByName(names[i]
51: .toLowerCase());
52: final IJavaSourceConverter converter2 = JavaSourceConverterProvider
53: .getJavaSourceConverterByName(names[i]
54: .toUpperCase());
55: assertSame(converter1, converter2);
56: }
57: }
58:
59: public void testGetAllConvetersReturnsConverters() {
60: IJavaSourceConverter[] allConverters = JavaSourceConverterProvider
61: .getAllConverters();
62: assertTrue(allConverters.length > 2);
63: for (int i = 0; i < allConverters.length; ++i) {
64: assertNotNull(allConverters[i]);
65: }
66: }
67: }
|