Skip to main content
summaryrefslogtreecommitdiffstats
blob: 24f38e1c3239aa3e8e89ea665cebe66fac5d0ad3 (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
57
58
/*******************************************************************************
 * 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.fields;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.IOseeField;

/**
 * @author Roberto E. Escobar
 */
public class OseeFieldTestData<T> {
   private final IOseeField<T> field;
   private final Object initExpectedValue;
   private final boolean initExpectedDirty;

   private final Collection<FieldGetSetTestData<T>> testDatas;

   public OseeFieldTestData(IOseeField<T> field, Object initExpectedValue, boolean initExpectedDirty, FieldGetSetTestData<T>... testDatas) {
      this.field = field;
      this.initExpectedValue = initExpectedValue;
      this.initExpectedDirty = initExpectedDirty;
      this.testDatas = new ArrayList<FieldGetSetTestData<T>>();
      if (testDatas != null && testDatas.length > 0) {
         this.testDatas.addAll(Arrays.asList(testDatas));
      }
   }

   public IOseeField<T> getField() {
      return field;
   }

   public Object getInitExpectedValue() {
      return initExpectedValue;
   }

   public boolean isInitExpectedDirty() {
      return initExpectedDirty;
   }

   public Collection<FieldGetSetTestData<T>> getTestDatas() {
      return testDatas;
   }

   public void doSetValue(FieldGetSetTestData<T> testData) throws OseeCoreException {
      getField().set(testData.getSetValue());
   }
}

Back to the top