|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.testfw.codegen.ui.templates; |
|
19 |
|
20 import com.nokia.testfw.codegen.templates.CMDTemplateBuilder; |
|
21 import com.nokia.testfw.codegen.templates.TemplateBuilder; |
|
22 import com.nokia.testfw.codegen.templates.TemplateBuilderFactory; |
|
23 |
|
24 import junit.framework.TestCase; |
|
25 |
|
26 public class TemplateBuilderFactoryTest extends TestCase { |
|
27 |
|
28 public void testNewCMDTemplateBuilder() { |
|
29 System.setProperty(TemplateBuilderFactory.TEMPLATEBUILDERCLASS, |
|
30 CMDTemplateBuilder.class.getName()); |
|
31 TemplateBuilderFactory factory = TemplateBuilderFactory.newInstance(); |
|
32 TemplateBuilder builder = null; |
|
33 try { |
|
34 builder = factory.newTemplateBuilder(); |
|
35 } catch (Exception e) { |
|
36 e.printStackTrace(); |
|
37 fail("creating CMDTemplateBuilder failed."); |
|
38 } |
|
39 assertTrue(builder instanceof CMDTemplateBuilder); |
|
40 System.setProperty(TemplateBuilderFactory.TEMPLATEBUILDERCLASS, |
|
41 TemplateBuilderFactory.DEFAULTTEMPLATEBUILDERCLASS); |
|
42 } |
|
43 |
|
44 public void testNewEclipseTemplateBuilder() { |
|
45 System.setProperty(TemplateBuilderFactory.TEMPLATEBUILDERCLASS, |
|
46 EclipseTemplateBuilder.class.getName()); |
|
47 TemplateBuilderFactory factory = TemplateBuilderFactory.newInstance(); |
|
48 TemplateBuilder builder = null; |
|
49 try { |
|
50 builder = factory.newTemplateBuilder(); |
|
51 } catch (Exception e) { |
|
52 e.printStackTrace(); |
|
53 fail("creating EclipseTemplateBuilder failed."); |
|
54 } |
|
55 assertTrue(builder instanceof EclipseTemplateBuilder); |
|
56 System.setProperty(TemplateBuilderFactory.TEMPLATEBUILDERCLASS, |
|
57 TemplateBuilderFactory.DEFAULTTEMPLATEBUILDERCLASS); |
|
58 } |
|
59 } |