@@ -29,7 +29,7 @@ public class TestInterfaceFinder {
2929
3030 @ Test
3131 public void testGetAllInterfaces () {
32- Structure s = mockStructure ();
32+ Structure s = mockStructure (false );
3333 InterfaceFinder finder = new InterfaceFinder (s );
3434
3535 StructureInterfaceList list = finder .getAllInterfaces ();
@@ -50,11 +50,27 @@ public void testGetAllInterfaces() {
5050 assertEquals (3 , unique .size ());
5151 }
5252
53+ /**
54+ * Check that interfaces can be calculated if one polymer chain has no atoms at all
55+ */
56+ @ Test
57+ public void testGetAllInterfacesNoAtomsPoly () {
58+ Structure s = mockStructure (true );
59+ InterfaceFinder finder = new InterfaceFinder (s );
60+
61+ StructureInterfaceList list = finder .getAllInterfaces ();
62+
63+ assertEquals (1 , list .size ());
64+
65+ // make sure we did not alter the original poly chains
66+ assertEquals (3 , s .getPolyChains ().size ());
67+ }
68+
5369 /**
5470 * Create a mock structure with 2 entities 1 (chains A, B) and 2 (chain C).
5571 * @return a structure
5672 */
57- private Structure mockStructure () {
73+ private Structure mockStructure (boolean addNoAtomsPolyChain ) {
5874 Structure structure = new StructureImpl ();
5975 EntityInfo entity1 = new EntityInfo ();
6076 entity1 .setMolId (1 );
@@ -91,7 +107,13 @@ private Structure mockStructure() {
91107 chainB .setSeqResGroups (bGroups );
92108 chainB .setEntityInfo (entity1 );
93109
94- List <Group > cGroups = getGroupList (20 , "GLY" , chainC , new Point3d (0 , 4 , 0 ));
110+ int size ;
111+ if (addNoAtomsPolyChain )
112+ size = 0 ;
113+ else
114+ size = 20 ;
115+
116+ List <Group > cGroups = getGroupList (size , "GLY" , chainC , new Point3d (0 , 4 , 0 ));
95117 chainC .setAtomGroups (new ArrayList <>(cGroups ));
96118 chainC .setSeqResGroups (cGroups );
97119 chainC .setEntityInfo (entity2 );
0 commit comments