Author: kono
Date: 2012-04-18 13:53:13 -0700 (Wed, 18 Apr 2012)
New Revision: 28878
Added:
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/VisualPropertyDependencyTest.java
Modified:
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/mappings/ContinuousMappingPointTest.java
Log:
refs #874 New unit tests had been added to vizmap-api.
Added:
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/VisualPropertyDependencyTest.java
===================================================================
---
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/VisualPropertyDependencyTest.java
(rev 0)
+++
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/VisualPropertyDependencyTest.java
2012-04-18 20:53:13 UTC (rev 28878)
@@ -0,0 +1,85 @@
+package org.cytoscape.view.vizmap;
+
+import static org.junit.Assert.*;
+
+import java.awt.Paint;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.cytoscape.view.model.NullDataType;
+import org.cytoscape.view.model.VisualLexicon;
+import org.cytoscape.view.model.VisualProperty;
+import org.cytoscape.view.presentation.property.BasicVisualLexicon;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+public class VisualPropertyDependencyTest {
+
+ private VisualPropertyDependency<Paint> dependency;
+
+ private String displayName = "test dependency";
+ private Set<VisualProperty<Paint>> vpSet;
+
+ @Mock private VisualProperty<NullDataType> rootVisualProperty;
+
+ private VisualLexicon lexicon;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+
+ lexicon = new BasicVisualLexicon(rootVisualProperty);
+ vpSet = new HashSet<VisualProperty<Paint>>();
+ vpSet.add(BasicVisualLexicon.NODE_BORDER_PAINT);
+ vpSet.add(BasicVisualLexicon.NODE_FILL_COLOR);
+
+ dependency = new VisualPropertyDependency<Paint>(displayName,
vpSet, lexicon);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testVisualPropertyDependency() {
+ assertNotNull(dependency);
+ }
+
+ @Test
+ public void testGetDisplayName() {
+ assertEquals(displayName, dependency.getDisplayName());
+ }
+
+ @Test
+ public void testGetVisualProperties() {
+ assertEquals(vpSet, dependency.getVisualProperties());
+ }
+
+ @Test
+ public void testSetDependency() {
+ dependency.setDependency(true);
+ assertTrue(dependency.isDependencyEnabled());
+ }
+
+ @Test
+ public void testIsDependencyEnabled() {
+ assertFalse(dependency.isDependencyEnabled());
+ dependency.setDependency(true);
+ assertTrue(dependency.isDependencyEnabled());
+ }
+
+ @Test
+ public void testGetParentVisualProperty() {
+ VisualProperty<Paint> parent =
dependency.getParentVisualProperty();
+ assertNotNull(parent);
+ assertEquals(BasicVisualLexicon.NODE_PAINT, parent);
+ }
+
+ @Test
+ public void testToString() {
+ assertEquals(displayName, dependency.toString());
+ }
+}
Modified:
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/mappings/ContinuousMappingPointTest.java
===================================================================
---
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/mappings/ContinuousMappingPointTest.java
2012-04-18 18:58:26 UTC (rev 28877)
+++
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/mappings/ContinuousMappingPointTest.java
2012-04-18 20:53:13 UTC (rev 28878)
@@ -1,15 +1,29 @@
package org.cytoscape.view.vizmap.mappings;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.awt.Color;
+import java.awt.Paint;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class ContinuousMappingPointTest {
+
+ private ContinuousMappingPoint<Double,Paint> point;
+ private BoundaryRangeValues<Paint> brv1;
+ private BoundaryRangeValues<Paint> brv2;
+
+ private Double val1 = 100d;
+ private Double val2 = 0d;
@Before
public void setUp() throws Exception {
+ this.brv1 = new BoundaryRangeValues<Paint>(Color.RED,
Color.white, Color.GREEN);
+ this.brv2 = new BoundaryRangeValues<Paint>(Color.BLACK,
Color.YELLOW, Color.PINK);
+ point = new ContinuousMappingPoint<Double, Paint>(val1, brv1);
}
@After
@@ -18,22 +32,30 @@
@Test
public void testContinuousMappingPoint() {
+ assertNotNull(point);
}
@Test
public void testGetValue() {
+ final Double value = point.getValue();
+ assertEquals(val1, value);
}
@Test
public void testSetValue() {
+ point.setValue(val2);
+ assertEquals(val2, point.getValue());
}
@Test
public void testGetRange() {
+ assertEquals(brv1, point.getRange());
}
@Test
public void testSetRange() {
+ point.setRange(brv2);
+ assertEquals(brv2, point.getRange());
}
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.