test_class.file: misc/diff/src/test/java/org/openscience/cdk/tools/diff/AtomContainerDiffTest.java
test_class.identifier: AtomContainerDiffTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test
      public void testDifference() {
          IAtom carbon = mock(IAtom.class);
          IAtom oxygen = mock(IAtom.class);
  
          when(carbon.getSymbol()).thenReturn("C");
          when(oxygen.getSymbol()).thenReturn("O");
  
          IBond b1 = mock(IBond.class);
          IBond b2 = mock(IBond.class);
  
          when(b1.getOrder()).thenReturn(IBond.Order.SINGLE);
          when(b2.getOrder()).thenReturn(IBond.Order.DOUBLE);
  
          when(b1.getAtomCount()).thenReturn(2);
          when(b2.getAtomCount()).thenReturn(2);
  
          when(b1.getBegin()).thenReturn(carbon);
          when(b1.getEnd()).thenReturn(carbon);
          when(b2.getBegin()).thenReturn(carbon);
          when(b2.getEnd()).thenReturn(oxygen);
  
          IAtomContainer container1 = mock(IAtomContainer.class);
          IAtomContainer container2 = mock(IAtomContainer.class);
          when(container1.getElectronContainerCount()).thenReturn(1);
          when(container2.getElectronContainerCount()).thenReturn(1);
          when(container1.getElectronContainer(0)).thenReturn(b1);
          when(container2.getElectronContainer(0)).thenReturn(b2);
  
          String result = AtomContainerDiff.diff(container1, container2);
          Assert.assertNotNull(result);
      }
test_case.class_method_signature: AtomContainerDiffTest.testDifference()
test_case.full_signature: @Test public void testDifference()
test_case.identifier: testDifference
test_case.invocations: mock mock thenReturn when getSymbol thenReturn when getSymbol mock mock thenReturn when getOrder thenReturn when getOrder thenReturn when getAtomCount thenReturn when getAtomCount thenReturn when getBegin thenReturn when getEnd thenReturn when getBegin thenReturn when getEnd mock mock thenReturn when getElectronContainerCount thenReturn when getElectronContainerCount thenReturn when getElectronContainer thenReturn when getElectronContainer diff assertNotNull
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDifference()
focal_class.file: misc/diff/src/main/java/org/openscience/cdk/tools/diff/AtomContainerDiff.java
focal_class.identifier: AtomContainerDiff
focal_class.class_method_signature: AtomContainerDiff.AtomContainerDiff()
focal_class.full_signature: private  AtomContainerDiff()
focal_class.identifier: AtomContainerDiff
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  AtomContainerDiff()
focal_class.class_method_signature: AtomContainerDiff.diff(IChemObject first, IChemObject second)
focal_class.full_signature: public static String diff(IChemObject first, IChemObject second)
focal_class.identifier: diff
focal_class.modifiers: public static
focal_class.parameters: (IChemObject first, IChemObject second)
focal_class.return: String
focal_class.signature: String diff(IChemObject first, IChemObject second)
focal_class.class_method_signature: AtomContainerDiff.difference(IChemObject first, IChemObject second)
focal_class.full_signature: public static IDifference difference(IChemObject first, IChemObject second)
focal_class.identifier: difference
focal_class.modifiers: public static
focal_class.parameters: (IChemObject first, IChemObject second)
focal_class.return: IDifference
focal_class.signature: IDifference difference(IChemObject first, IChemObject second)
focal_method.body: public static IDifference difference(IChemObject first, IChemObject second) {
          if (!(first instanceof IAtomContainer && second instanceof IAtomContainer)) {
              return null;
          }
          IAtomContainer firstAC = (IAtomContainer) first;
          IAtomContainer secondAC = (IAtomContainer) second;
          ChemObjectDifference totalDiff = new ChemObjectDifference("AtomContainerDiff");
          totalDiff.addChild(IntegerDifference.construct("atomCount", firstAC.getAtomCount(), secondAC.getAtomCount()));
          if (firstAC.getAtomCount() == secondAC.getAtomCount()) {
              for (int i = 0; i < firstAC.getAtomCount(); i++) {
                  totalDiff.addChild(AtomDiff.difference(firstAC.getAtom(i), secondAC.getAtom(i)));
              }
          }
          totalDiff.addChild(IntegerDifference.construct("electronContainerCount", firstAC.getElectronContainerCount(),
                  secondAC.getElectronContainerCount()));
          if (firstAC.getElectronContainerCount() == secondAC.getElectronContainerCount()) {
              for (int i = 0; i < firstAC.getElectronContainerCount(); i++) {
                  if (firstAC.getElectronContainer(i) instanceof IBond
                          && secondAC.getElectronContainer(i) instanceof IBond) {
                      totalDiff.addChild(BondDiff.difference(firstAC.getElectronContainer(i),
                              secondAC.getElectronContainer(i)));
                  } else if (firstAC.getElectronContainer(i) instanceof ILonePair
                          && secondAC.getElectronContainer(i) instanceof ILonePair) {
                      totalDiff.addChild(LonePairDiff.difference(firstAC.getElectronContainer(i),
                              secondAC.getElectronContainer(i)));
                  } else if (firstAC.getElectronContainer(i) instanceof ISingleElectron
                          && secondAC.getElectronContainer(i) instanceof ISingleElectron) {
                      totalDiff.addChild(SingleElectronDiff.difference(firstAC.getElectronContainer(i),
                              secondAC.getElectronContainer(i)));
                  } else {
                      totalDiff.addChild(ElectronContainerDiff.difference(firstAC.getElectronContainer(i),
                              secondAC.getElectronContainer(i)));
                  }
              }
          }
          totalDiff.addChild(ChemObjectDiff.difference(first, second));
          if (totalDiff.childCount() > 0) {
              return totalDiff;
          } else {
              return null;
          }
      }
focal_method.class_method_signature: AtomContainerDiff.difference(IChemObject first, IChemObject second)
focal_method.full_signature: public static IDifference difference(IChemObject first, IChemObject second)
focal_method.identifier: difference
focal_method.invocations: addChild construct getAtomCount getAtomCount getAtomCount getAtomCount getAtomCount addChild difference getAtom getAtom addChild construct getElectronContainerCount getElectronContainerCount getElectronContainerCount getElectronContainerCount getElectronContainerCount getElectronContainer getElectronContainer addChild difference getElectronContainer getElectronContainer getElectronContainer getElectronContainer addChild difference getElectronContainer getElectronContainer getElectronContainer getElectronContainer addChild difference getElectronContainer getElectronContainer addChild difference getElectronContainer getElectronContainer addChild difference childCount
focal_method.modifiers: public static
focal_method.parameters: (IChemObject first, IChemObject second)
focal_method.return: IDifference
focal_method.signature: IDifference difference(IChemObject first, IChemObject second)