Skip to main content
summaryrefslogtreecommitdiffstats
blob: 31784c877731133f6406fa201dcb3e02cbef61d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.framework.core.model.test.fields;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import org.junit.Assert;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.internal.fields.BranchAliasesField;
import org.junit.Test;

/**
 * Test Case For {@link BranchAliasesField}
 * 
 * @author Roberto E. Escobar
 */
public class BranchAliasesFieldTest {

   @Test
   public void testSetGet() throws OseeCoreException {
      Collection<String> aliases = new ArrayList<String>();
      BranchAliasesField field = new BranchAliasesField(aliases);
      Assert.assertEquals(false, field.isDirty());

      FieldTestUtil.assertSetGet(field, Arrays.asList("A", "B", "C"), Arrays.asList("a", "b", "c"), true);
      field.clearDirty();
      Assert.assertEquals(false, field.isDirty());

      // Same but with changed order and case
      FieldTestUtil.assertSetGet(field, Arrays.asList("C", "a", "b"), Arrays.asList("a", "b", "c"), false);
      Assert.assertEquals(false, field.isDirty());

      // Remove two
      FieldTestUtil.assertSetGet(field, Arrays.asList("C"), Arrays.asList("c"), true);
      field.clearDirty();

      // Add
      FieldTestUtil.assertSetGet(field, Arrays.asList("C", "WhaT!21", "AgAin"), Arrays.asList("c", "what!21", "again"),
         true);
      field.clearDirty();

      // Add Empty
      FieldTestUtil.assertSetGet(field, Collections.<String> emptyList(), Collections.<String> emptyList(), true);
      field.clearDirty();
   }
}

Back to the top