Skip to content

Commit 979d7ac

Browse files
committed
Fix test chemistry, remove 66 EBIMatrix locks, validate inputs, clean dead code
Test correctness: - AldolCleavage: fix unbalanced SMILES (5C→4C, now 4C→4C balanced) - RingOpeningOzonolysis: add missing water product (oxygen balance) - AlanineRacemase: test stereo fingerprint instead of null check - R00001: replace trivially-true assertion with assertNotNull API robustness: - ReactionMechanismTool: add null reaction validation (throws IllegalArgumentException); warn on empty reactants/products; replace synchronizedList with plain ArrayList - EBIMatrix: remove synchronized from all 66 methods (not designed for concurrent access, lock overhead was pure waste) Cleanup: - TestUtility: remove ~250 lines of dead commented-out code - Mark SMSDTest and UnblancedReactionChecker as manual utilities All 46 tests pass. Net -251 lines. Author: Syed Asad Rahman <asad.rahman@bioinceptionlabs.com>
1 parent 78fec01 commit 979d7ac

7 files changed

Lines changed: 90 additions & 341 deletions

File tree

src/main/java/com/bioinceptionlabs/reactionblast/mechanism/ReactionMechanismTool.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
import static java.lang.Integer.parseInt;
6060
import static java.lang.Math.abs;
6161
import static java.lang.System.getProperty;
62-
import static java.util.Collections.synchronizedList;
6362

6463
import org.openscience.cdk.smiles.SmiFlavor;
6564
import static org.openscience.cdk.tools.manipulator.AtomContainerManipulator.getAtomArray;
@@ -153,10 +152,17 @@ public ReactionMechanismTool(IReaction reaction,
153152
boolean checkComplex,
154153
boolean accept_no_change,
155154
IStandardizer standardizer) throws CDKException, AssertionError, Exception {
156-
this.allSolutions = synchronizedList(new ArrayList<>());
155+
if (reaction == null) {
156+
throw new IllegalArgumentException("Reaction cannot be null");
157+
}
158+
this.allSolutions = new ArrayList<>();
157159
this.selectedMapping = null;
158160
this.accept_no_change = accept_no_change;//transporter reactions
159161

162+
if (reaction.getReactantCount() == 0 || reaction.getProductCount() == 0) {
163+
LOGGER.warn("Reaction has no reactants or no products: {0}", reaction.getID());
164+
}
165+
160166
/*
161167
* IMP: Set all null hydrogen counts to 0, else CDKToBeam cries out loudly
162168
*/

0 commit comments

Comments
 (0)