imakerplugin/com.nokia.s60tools.imaker.tests/src/com/nokia/s60tools/imaker/internal/iqrf/tests/InterfaceTest.java
changeset 0 61163b28edca
equal deleted inserted replaced
-1:000000000000 0:61163b28edca
       
     1 /*
       
     2 * Copyright (c) 2008 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.s60tools.imaker.internal.iqrf.tests;
       
    19 
       
    20 import java.util.List;
       
    21 
       
    22 import junit.framework.TestCase;
       
    23 
       
    24 import com.nokia.s60tools.imaker.internal.iqrf.ConfigurationElement;
       
    25 import com.nokia.s60tools.imaker.internal.iqrf.IQRFFactory;
       
    26 import com.nokia.s60tools.imaker.internal.iqrf.Interface;
       
    27 
       
    28 public class InterfaceTest extends TestCase {
       
    29 	protected Interface fixture = null;
       
    30 
       
    31 	protected void setFixture(Interface fixture) {
       
    32 		this.fixture = fixture;
       
    33 	}
       
    34 
       
    35 	private Interface getFixture() {
       
    36 		return fixture;
       
    37 	}
       
    38 
       
    39 	public void setUp() throws Exception {
       
    40 		setFixture(IQRFFactory.eINSTANCE.createInterface());
       
    41 	}
       
    42 
       
    43 	public void tearDown() throws Exception {
       
    44 		setFixture(null);
       
    45 	}
       
    46 
       
    47 	public void testAddConfigurationElement__ConfigurationElement() {
       
    48 		// Ensure that you remove @generated or mark it @generated NOT
       
    49 		ConfigurationElement c1 = IQRFFactory.eINSTANCE.createConfigurationElement();
       
    50 		ConfigurationElement c2 = IQRFFactory.eINSTANCE.createConfigurationElement();
       
    51 		Interface it = getFixture();
       
    52 		it.addConfigurationElement(c1);
       
    53 		it.addConfigurationElement(c2);
       
    54 		List conelements = (List)it.getConfigurationElements();
       
    55 		assertTrue(conelements.contains(c1));
       
    56 		assertTrue(conelements.contains(c2));
       
    57 		assertEquals(conelements.get(0),c1);
       
    58 	}
       
    59 	
       
    60 	public void testName() {
       
    61 		String name = "interfaceName";
       
    62 		Interface it = getFixture();
       
    63 		it.setName(name);
       
    64 		assertEquals(it.getName(),name);
       
    65 	}
       
    66 } //InterfaceTest