1 package jalview.datamodel;
3 import org.testng.Assert;
4 import org.testng.annotations.BeforeClass;
5 import org.testng.annotations.Test;
7 import jalview.gui.JvOptionPane;
9 public class ContactMatrixTest
11 @BeforeClass(alwaysRun = true)
12 public void setUpJvOptionPane()
14 JvOptionPane.setInteractiveMode(false);
15 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
19 * standard asserts for ContactMatrixI
21 public static void testContactMatrixI(ContactMatrixI cm,
24 // assume contact matrix is square for text
25 ContactListI clist = cm.getContactList(1);
27 int width = clist.getContactHeight();
28 Double minValue, maxValue;
29 minValue = clist.getContactAt(0);
32 for (int p = 0; p < width; p++)
34 ContactListI pList = cm.getContactList(p);
35 for (int q = p; q < width; q++)
39 // compute minMax for pList
40 minMax(minValue, maxValue, pList);
43 ContactListI qList = cm.getContactList(q);
46 Assert.assertEquals(qList.getContactAt(p), pList.getContactAt(q),
47 "Contact matrix not symmetric");
51 Assert.assertNotEquals(qList.getContactAt(p),
52 pList.getContactAt(q),
53 "Contact matrix expected to be not symmetric");
59 private static void minMax(Double minValue, Double maxValue,
62 int width = pList.getContactHeight();
63 for (int rowcol = 0; rowcol < width; rowcol++)
65 double v = pList.getContactAt(rowcol);
77 @Test(groups = { "Functional" })
78 public void testminMaxCalc()
80 ContactListI clist = new ContactListImpl(new ContactListProviderI()
82 double[] val = { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7 };
85 public int getPosition()
91 public int getContactHeight()
97 public double getContactAt(int column)
99 if (column < 0 || column >= val.length)
107 // TODO - write test !
111 * test construction and accessors for asymmetric contact matrix
113 @Test(groups = { "Functional" })
114 public void testAsymmetricContactMatrix()
116 // TODO - write test !
121 * test construction and accessors for symmetric contact matrix
123 @Test(groups = { "Functional" })
124 public void testSymmetricContactMatrix()
126 // TODO - write test !