| 1 |
|
package jalview.gui.structurechooser; |
| 2 |
|
|
| 3 |
|
import static org.testng.Assert.*; |
| 4 |
|
|
| 5 |
|
import java.util.ArrayList; |
| 6 |
|
import java.util.List; |
| 7 |
|
|
| 8 |
|
import javax.swing.JTable; |
| 9 |
|
import javax.swing.table.DefaultTableModel; |
| 10 |
|
|
| 11 |
|
import org.testng.annotations.DataProvider; |
| 12 |
|
import org.testng.annotations.Test; |
| 13 |
|
|
| 14 |
|
import jalview.datamodel.PDBEntry; |
| 15 |
|
import jalview.datamodel.Sequence; |
| 16 |
|
import jalview.datamodel.SequenceI; |
| 17 |
|
import jalview.structure.StructureImportSettings.TFType; |
| 18 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (46) |
Complexity: 6 |
Complexity Density: 0.17 |
|
| 19 |
|
public class ThreeDBStructureChooserQuerySourceTest { |
| 20 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 21 |
1 |
@DataProvider(name = "threeDBStructData")... |
| 22 |
|
public Object[][] beaconSourceScores() { |
| 23 |
1 |
return new Object[][] { |
| 24 |
|
{ "AlphaFold DB", "PLDDT", 91.0, null, TFType.PLDDT }, |
| 25 |
|
{ "SwissModel", "QMEANDISCO", 0.65, "v1.2", TFType.QMEANDISCO }, |
| 26 |
|
{ "PDBe", null, null, null, null }, |
| 27 |
|
}; |
| 28 |
|
} |
| 29 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (43) |
Complexity: 5 |
Complexity Density: 0.14 |
1PASS
|
|
| 30 |
3 |
@Test(dataProvider = "threeDBStructData", groups = { "Functional" })... |
| 31 |
|
public void testCollectSelectedRows( |
| 32 |
|
String provider, |
| 33 |
|
String confType, |
| 34 |
|
Double score, |
| 35 |
|
String version, |
| 36 |
|
TFType expectedTFType |
| 37 |
|
) { |
| 38 |
3 |
String[] columns = { |
| 39 |
|
"Model id", "Url", "Provider", "Page URL", "Model Format", |
| 40 |
|
"Model Category", "Confidence", "Confidence Score Type", "Confidence Score Version", |
| 41 |
|
"Uniprot Start", "Uniprot End", "Ref Sequence" |
| 42 |
|
}; |
| 43 |
|
|
| 44 |
3 |
Object[][] data = new Object[1][columns.length]; |
| 45 |
3 |
data[0][0] = "model1"; |
| 46 |
3 |
data[0][1] = "https://structure.com"; |
| 47 |
3 |
data[0][2] = provider; |
| 48 |
3 |
data[0][3] = "https://structure.com"; |
| 49 |
3 |
data[0][4] = "PDB"; |
| 50 |
3 |
data[0][5] = "Experimental"; |
| 51 |
3 |
data[0][6] = score; |
| 52 |
3 |
data[0][7] = confType; |
| 53 |
3 |
data[0][8] = version; |
| 54 |
3 |
data[0][9] = 1; |
| 55 |
3 |
data[0][10] = 100; |
| 56 |
3 |
SequenceI seq = new Sequence("seq", "SEQUENCEA"); |
| 57 |
3 |
seq.createDatasetSequence(); |
| 58 |
3 |
data[0][11] = seq; |
| 59 |
|
|
| 60 |
3 |
JTable mockData = new JTable(new DefaultTableModel(data, columns)); |
| 61 |
3 |
ThreeDBStructureChooserQuerySource query = new ThreeDBStructureChooserQuerySource(); |
| 62 |
3 |
List<SequenceI> sequences = new ArrayList<>(); |
| 63 |
|
|
| 64 |
3 |
PDBEntry[] result = query.collectSelectedRows(mockData, new int[]{0}, sequences); |
| 65 |
|
|
| 66 |
3 |
assertNotNull(result); |
| 67 |
3 |
assertEquals(result.length, 1); |
| 68 |
3 |
PDBEntry pdbEntry = result[0]; |
| 69 |
|
|
| 70 |
3 |
assertEquals(pdbEntry.getId(), "model1"); |
| 71 |
3 |
assertEquals(pdbEntry.getProvider(), provider); |
| 72 |
|
|
| 73 |
3 |
if (expectedTFType != null) { |
| 74 |
2 |
assertEquals(pdbEntry.getTempFacTypeTFType(), expectedTFType, "TFType mismatch"); |
| 75 |
|
} else { |
| 76 |
1 |
assertNull(pdbEntry.getTempFacTypeTFType(), "TFType should be null"); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
3 |
if (score != null) { |
| 80 |
2 |
assertEquals(pdbEntry.getModelConfidence(), score); |
| 81 |
|
} else { |
| 82 |
1 |
assertNull(pdbEntry.getModelConfidence()); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
3 |
if (confType != null) { |
| 86 |
2 |
assertEquals(pdbEntry.getModelConfidenceType(), confType); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
3 |
if (version != null) { |
| 90 |
1 |
assertEquals(pdbEntry.getModelConfidenceVersion(), version); |
| 91 |
|
} |
| 92 |
|
} |
| 93 |
|
} |