<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.biojava.bio.structure;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.biojava.bio.structure.io.PDBParseException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 * Tests functionality of Site class.
 * @author <NAME> <<EMAIL>>
 */
public class SiteTest {

    public static final String newline = System.getProperty("line.separator");

    private static Site catSite;
    private static Site bindingSite;

    private static List<Group> bindingSiteGroups;

    public SiteTest() {
        try {
            // sites CAT and AC1 from PDB entry 1a4w
            //SITE     1 CAT  3 HIS H  57  ASP H 102  SER H 195
            //SITE     1 AC1  6 ARG H 221A LYS H 224  HOH H 403  HOH H 460
            //SITE     2 AC1  6 HOH H 464  HOH H 497
            //groups for site CAT
            Group his57 = new AminoAcidImpl();
            his57.setPDBCode("H  57");
            his57.setPDBName("HIS");
            Group asp102 = new AminoAcidImpl();
            asp102.setPDBCode("H 102");
            asp102.setPDBName("ASP");
            Group ser195 = new AminoAcidImpl();
            ser195.setPDBCode("H 195");
            ser195.setPDBName("SER");
            List<Group> catSiteGroups = new ArrayList<Group>();
            catSiteGroups.add(his57);
            catSiteGroups.add(asp102);
            catSiteGroups.add(ser195);
            //make the catalytic site CAT
            catSite = new Site();
            catSite.setSiteID("CAT");
            catSite.setGroups(catSiteGroups);
            //groups for site AC1
            Group arg221a = new AminoAcidImpl();
            arg221a.setPDBCode("H 221A");
            arg221a.setPDBName("ARG");
            Group lys224 = new AminoAcidImpl();
            lys224.setPDBCode("H 224");
            lys224.setPDBName("LYS");
            Group hoh403 = new HetatomImpl();
            hoh403.setPDBCode("H 403");
            hoh403.setPDBName("HOH");
            Group hoh460 = new HetatomImpl();
            hoh460.setPDBCode("H 460");
            hoh460.setPDBName("HOH");
            Group hoh464 = new HetatomImpl();
            hoh464.setPDBCode("H 464");
            hoh464.setPDBName("HOH");
            Group hoh497 = new HetatomImpl();
            hoh497.setPDBCode("H 497");
            hoh497.setPDBName("HOH");

            bindingSiteGroups = new ArrayList<Group>();
            
            bindingSiteGroups.add(arg221a);
            bindingSiteGroups.add(lys224);
            bindingSiteGroups.add(hoh403);
            bindingSiteGroups.add(hoh460);
            bindingSiteGroups.add(hoh464);
            bindingSiteGroups.add(hoh497);
            //make the binding site AC1
            bindingSite = new Site();
            bindingSite.setSiteID("AC1");
            bindingSite.setGroups(bindingSiteGroups);
        } catch (PDBParseException ex) {
            Logger.getLogger(SiteTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of toPDB method, of class Site.
     */
    @Test
    public void testToPDB_0args() {
        System.out.println("toPDB_0args");
//        String expResult =  "SITE     1 AC1  6 ARG H 221A LYS H 224  HOH H 403  HOH H 460                    " + newline +
//                            "SITE     2 AC1  6 HOH H 464  HOH H 497  ";
        String expResult =  "SITE     1 AC1  6 ARG H 221A LYS H 224  HOH H 403  HOH H 460" + newline +
                            "SITE     2 AC1  6 HOH H 464  HOH H 497"+ newline;
        String result = bindingSite.toPDB();
        System.out.println(result);
        assertEquals(expResult, result);
    }

    /**
     * Test of toPDB method, of class Site.
     */
    @Test
    public void testToPDB_StringBuffer() {
        System.out.println("toPDB");
        StringBuffer buf = new StringBuffer("");
//        String expResult =  "SITE     1 AC1  6 ARG H 221A LYS H 224  HOH H 403  HOH H 460                    " + newline +
//                            "SITE     2 AC1  6 HOH H 464  HOH H 497  ";
        String expResult =  "SITE     1 AC1  6 ARG H 221A LYS H 224  HOH H 403  HOH H 460" + newline +
                            "SITE     2 AC1  6 HOH H 464  HOH H 497"+ newline;
        bindingSite.toPDB(buf);
        String result = buf.toString();
        System.out.println(result);
        assertEquals(expResult, result);
    }


    /**
     * Test of getSiteID method, of class Site.
     */
    @Test
    public void testGetSiteID() {
        System.out.println("getSiteID");
        String expResult = "CAT";
        String result = catSite.getSiteID();
        assertEquals(expResult, result);
    }

    /**
     * Test of getGroups method, of class Site.
     */
    @Test
    public void testGetResidues() {
        System.out.println("getGroups");
        List expResult = bindingSiteGroups;
        List result = bindingSite.getGroups();
        assertEquals(expResult, result);
    }
<commit_msg>Updated SiteTest to have the correct tests! <commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.biojava.bio.structure;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.biojava.bio.structure.io.PDBParseException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 * Tests functionality of Site class.
 * @author <NAME> <<EMAIL>>
 */
public class SiteTest {

    public static final String newline = System.getProperty("line.separator");

    private static Site catSite;
    private static Site bindingSite;

    private static List<Group> bindingSiteGroups;

    public SiteTest() {
        try {
            // sites CAT and AC1 from PDB entry 1a4w
            //SITE     1 CAT  3 HIS H  57  ASP H 102  SER H 195
            //SITE     1 AC1  6 ARG H 221A LYS H 224  HOH H 403  HOH H 460
            //SITE     2 AC1  6 HOH H 464  HOH H 497
            //groups for site CAT
            Group his57 = new AminoAcidImpl();
            his57.setPDBCode("H  57");
            his57.setPDBName("HIS");
            Group asp102 = new AminoAcidImpl();
            asp102.setPDBCode("H 102");
            asp102.setPDBName("ASP");
            Group ser195 = new AminoAcidImpl();
            ser195.setPDBCode("H 195");
            ser195.setPDBName("SER");
            List<Group> catSiteGroups = new ArrayList<Group>();
            catSiteGroups.add(his57);
            catSiteGroups.add(asp102);
            catSiteGroups.add(ser195);
            //make the catalytic site CAT
            catSite = new Site();
            catSite.setSiteID("CAT");
            catSite.setGroups(catSiteGroups);
            //groups for site AC1
            Group arg221a = new AminoAcidImpl();
            arg221a.setPDBCode("H 221A");
            arg221a.setPDBName("ARG");
            Group lys224 = new AminoAcidImpl();
            lys224.setPDBCode("H 224");
            lys224.setPDBName("LYS");
            Group hoh403 = new HetatomImpl();
            hoh403.setPDBCode("H 403");
            hoh403.setPDBName("HOH");
            Group hoh460 = new HetatomImpl();
            hoh460.setPDBCode("H 460");
            hoh460.setPDBName("HOH");
            Group hoh464 = new HetatomImpl();
            hoh464.setPDBCode("H 464");
            hoh464.setPDBName("HOH");
            Group hoh497 = new HetatomImpl();
            hoh497.setPDBCode("H 497");
            hoh497.setPDBName("HOH");

            bindingSiteGroups = new ArrayList<Group>();
            
            bindingSiteGroups.add(arg221a);
            bindingSiteGroups.add(lys224);
            bindingSiteGroups.add(hoh403);
            bindingSiteGroups.add(hoh460);
            bindingSiteGroups.add(hoh464);
            bindingSiteGroups.add(hoh497);
            //make the binding site AC1
            bindingSite = new Site();
            bindingSite.setSiteID("AC1");
            bindingSite.setGroups(bindingSiteGroups);
        } catch (PDBParseException ex) {
            Logger.getLogger(SiteTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of toPDB method, of class Site.
     */
    @Test
    public void testToPDB_0args() {
        System.out.println("toPDB_0args");
        String expResult =  "SITE     1 AC1  6 ARG H 221A LYS H 224  HOH H 403  HOH H 460                    " + newline +
                            "SITE     2 AC1  6 HOH H 464  HOH H 497                                          "+ newline;
        String result = bindingSite.toPDB();
        System.out.println(result);
        assertEquals(expResult, result);
    }

    /**
     * Test of toPDB method, of class Site.
     */
    @Test
    public void testToPDB_StringBuffer() {
        System.out.println("toPDB");
        StringBuffer buf = new StringBuffer("");
        String expResult =  "SITE     1 AC1  6 ARG H 221A LYS H 224  HOH H 403  HOH H 460                    " + newline +
                            "SITE     2 AC1  6 HOH H 464  HOH H 497                                          "+ newline;
        bindingSite.toPDB(buf);
        String result = buf.toString();
        System.out.println(result);
        assertEquals(expResult, result);
    }


    /**
     * Test of getSiteID method, of class Site.
     */
    @Test
    public void testGetSiteID() {
        System.out.println("getSiteID");
        String expResult = "CAT";
        String result = catSite.getSiteID();
        assertEquals(expResult, result);
    }

    /**
     * Test of getGroups method, of class Site.
     */
    @Test
    public void testGetResidues() {
        System.out.println("getGroups");
        List expResult = bindingSiteGroups;
        List result = bindingSite.getGroups();
        assertEquals(expResult, result);
    }

{'fraction_non_alphanumeric': 0.10071875291701671, 'fraction_numerical': 0.04555213292261738, 'mean_word_length': 1.8224446786090622, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5831027', 'n_tokens_mistral': 3567, 'n_tokens_neox': 3146, 'n_words': 855}