@@ -0,0 +1,2881 @@
+/*%0A * The Gemma project%0A * %0A * Copyright (c) 2010 University of British Columbia%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *       http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A *%0A */%0A%0Apackage ubic.gemma.loader.protein;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.fail;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport ubic.gemma.model.common.description.DatabaseEntry;%0A%0A/**%0A * Test to ensure string links are set correctly in gemma and that evidence codes for interactions are correctly set.%0A * %0A * @author ldonnison%0A * @version $Id$%0A */%0Apublic class ProteinLinkOutFormatterTest %7B%0A    %0A    private ProteinLinkOutFormatter formatter= null;%0A    DatabaseEntry entry = DatabaseEntry.Factory.newInstance();%0A    private static String accession =  %229606.ENSP00000293813%250D9606.ENSP00000360616%22;%0A    private static String url =  %22http://string-db.org/version_8_2/newstring_cgi/show_network_section.pl?identifier%22;%0A    private static String baseFormattedUrl = url.concat(%22s=%22).concat(accession);%0A    %0A    @Before%0A    public void setUp() throws Exception %7B        %0A        formatter = new ProteinLinkOutFormatter();      %0A        entry.setUri( url + %22=%22 );       %0A        entry.setAccession( accession );%0A    %7D%0A   %0A%0A    @Test%0A    public void testGetStringProteinProteinInteractionLinkFormatted() %7B%0A        String urlForString = formatter.getStringProteinProteinInteractionLinkGemmaDefault( entry );    %0A        String defaultUrl = (baseFormattedUrl.concat(%22&required_score=150%22));%0A        assertEquals(defaultUrl, urlForString);%0A        System.out.println(defaultUrl);%0A    %7D%0A%0A    @Test%0A    public void testGetStringProteinProteinInteractionLinkDefault() %7B%0A        String urlForString = formatter.getStringProteinProteinInteractionLinkFormatted( entry, %2220%22, %22420%22 );%0A        String defaultUrl = (baseFormattedUrl.concat( %22&limit=20%22 ).concat(%22&required_score=420%22));%0A        assertEquals(defaultUrl, urlForString);%0A        System.out.println(defaultUrl);%0A        %0A        %0A    %7D%0A%0A    @Test%0A    public void testGetEvidenceDisplayText() %7B%0A        byte%5B%5D bytes = new byte%5B%5D%7B0,0,0,0,1,0,1%7D;%0A        try %7B%0A            String evidenceText = formatter.getEvidenceDisplayText( bytes );%0A            assertEquals(%22Experimental:TextMining%22,evidenceText );%0A            %0A        %7D catch ( Exception e ) %7B           %0A            e.printStackTrace();%0A            fail();%0A        %7D%0A        %0A    %7D%0A%0A%7D%0A

Test to check string links are correctly formatted and evidence codes