/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */
package org.biojava.nbio.structure.symmetry.internal;

import java.io.IOException;
import org.biojava.nbio.structure.Atom;
import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.StructureTools;
import org.biojava.nbio.structure.symmetry.internal.CeSymm;
import org.junit.Test;

/**
 * Test for the old bug of non-independent CeSymm runs.
 * 
 * @author Spencer Bliven
 * @author Aleix Lafita
 * 
 */
public class TestCeSymm {

	@Test
	public void testIndependence() throws IOException, StructureException {

		// Only instantiate one CeSymm class
		String name;
		Atom[] atoms;

		name = "1MER.A";
		atoms = StructureTools.getRepresentativeAtomArray(StructureTools
				.getStructure(name));
		CeSymm.analyze(atoms);

		name = "1ijq.A:377-641";
		atoms = StructureTools.getRepresentativeAtomArray(StructureTools
				.getStructure(name));
		// This was causing an assertion error if runs are dependent
		CeSymm.analyze(atoms);
	}

}

@@ -647,16 +647,51 @@
 ernal;%0A%0A
+import static org.junit.Assert.*;%0A%0A
 import j
@@ -702,32 +702,33 @@
 io.IOException;%0A
+%0A
 import org.bioja
@@ -751,16 +751,61 @@
 e.Atom;%0A
+import org.biojava.nbio.structure.Structure;%0A
 import o
@@ -995,59 +995,109 @@
 %0A * 
-Test for the old bug of non-independent CeSymm runs
+Run two easy cases of internal symmetry and test that results are significant%0A * and order is correct
 .%0A *
@@ -1270,148 +1270,171 @@
 %0A%0A%09%09
-// Only instantiate one CeSymm class%0A%09%09String name;%0A%09%09Atom%5B%5D atoms;%0A%0A%09%09name = %221MER.A%22;%0A%09%09atoms = StructureTools.getRepresentativeAtomArray(
+String%5B%5D names = new String%5B%5D %7B %221hiv.A%22, %224i4q%22, %221n0r.A%22%7D;%0A%09%09int%5B%5D orders = new int%5B%5D %7B 2, 3, 4 %7D;%0A%0A%09%09for (int i = 0; i %3C names.length; i++) %7B%0A%0A%09%09%09Structure s = 
 Stru
@@ -1435,37 +1435,32 @@
 = StructureTools
-%0A%09%09%09%09
 .getStructure(na
@@ -1465,248 +1465,224 @@
 name
-)
+s%5Bi%5D
 );%0A%09%09
-CeSymm.analyze(atoms);%0A%0A%09%09name = %221ijq.A:377-641%22;%0A%09%09atoms = StructureTools.getRepresentativeAtomArray(StructureTools%0A%09%09%09%09.getStructure(name)
+%09Atom%5B%5D atoms = StructureTools.getRepresentativeAtomArray(s);%0A%0A%09%09%09CeSymmResult result = CeSymm.analyze(atoms
 );%0A
+%0A
 %09%09
-// This was causing an assertion error if runs are dependent%0A%09%09CeSymm.analyze(atoms
+%09assertTrue(result.isSignificant());%0A%09%09%09assertEquals(result.getSymmOrder(), orders%5Bi%5D
 );%0A
+%09
 %09%7D%0A
+%09%7D
 %0A%7D%0A

Create TestCeSymm with some easy examples that must be correct