package org.bridgedb.mysql.justification;

import org.bridgedb.rdf.constants.ChemInf;
import org.bridgedb.rdf.constants.OboConstants;
import org.bridgedb.sql.justification.JustificationMaker;
import org.bridgedb.sql.justification.OpsJustificationMaker;
import org.bridgedb.utils.BridgeDBException;
import static org.junit.Assert.*;
import org.junit.BeforeClass;

import org.junit.Test;

public class OpsJustificationMakerTest {

    static JustificationMaker justificationMaker;
   
    @BeforeClass
    public static void setUpClass() throws BridgeDBException {
        OpsJustificationMaker.init();
        justificationMaker = OpsJustificationMaker.getInstance();
    }

    @Test
    public void testCombine_same() throws BridgeDBException {		
        String justification = "http://www.example.org/test#justification";
        assertEquals(justification, justificationMaker.combine(justification , justification));
    }
	
    @Test(expected=BridgeDBException.class)
    public void testCombine_diff() throws BridgeDBException {		
        String justification1 = "http://www.example.org/test#justification";
        String justification2 = "http://www.example.com/test#different";
        justificationMaker.combine(justification1, justification2);
    }	

    @Test
    public void testCombine_hack1() throws BridgeDBException {		
        String justification1 = "http://example.com/EnsemblBasedProteinGene";
        String justification2 = "http://semanticscience.org/resource/SIO_010035";
        justificationMaker.combine(justification1, justification2);
    }
        
    @Test
    public void testCombine_hack2() throws BridgeDBException {		
        String justification1 = "http://semanticscience.org/resource/SIO_010035";
        String justification2 = "http://example.com/EnsemblBasedProteinGene";
       	justificationMaker.combine(justification1, justification2);
    }	

    @Test
    public void testCombine_inchi() throws BridgeDBException {
        assertEquals(ChemInf.INCHI_KEY, 
                justificationMaker.combine(ChemInf.INCHI_KEY, ChemInf.INCHI_KEY));
    }

    @Test
    public void testCombine_inchi_oboHasParts() throws BridgeDBException {
        assertEquals(OboConstants.HAS_PART, 
                justificationMaker.combine(ChemInf.INCHI_KEY, OboConstants.HAS_PART));
    }

    @Test
    public void testCombine_oboHasParts_inchi() throws BridgeDBException {
        assertEquals(OboConstants.HAS_PART, 
                justificationMaker.combine(OboConstants.HAS_PART, ChemInf.INCHI_KEY));
    }
    
    @Test
    public void testCombine_narrowMatch_oboHasParts() throws BridgeDBException {
        assertEquals(ChemInf.CHEMICAL_ENTITY, justificationMaker.combine(ChemInf.CHEMICAL_ENTITY, ChemInf.INCHI_KEY));
    }

    
        
	
}

@@ -295,22 +295,16 @@
 on;%0A
+%0A
 import 
-static 
 org.
@@ -313,16 +313,30 @@
 nit.
+jupiter.api.
 Assert
-.*
+ions
 ;%0Aim
@@ -350,27 +350,72 @@
 g.junit.
-BeforeClass
+jupiter.api.BeforeAll;%0Aimport org.junit.jupiter.api.Test
 ;%0A%0Aimpor
@@ -408,32 +408,39 @@
 i.Test;%0A%0Aimport 
+static 
 org.junit.Test;%0A
@@ -433,20 +433,51 @@
 g.junit.
-Test
+jupiter.api.Assertions.assertEquals
 ;%0A%0Apubli
@@ -578,21 +578,19 @@
  @Before
-Class
+All
 %0A    pub
@@ -753,32 +753,54 @@
 ();%0A    %7D%0A%0A    @
+org.junit.jupiter.api.
 Test%0A    public 
@@ -1045,42 +1045,8 @@
 Test
-(expected=BridgeDBException.class)
 %0A   
@@ -1095,35 +1095,102 @@
 dgeDBException %7B
-%09%09
 %0A
+        Assertions.assertThrows(BridgeDBException.class, () -%3E %7B%0A    
         String j
@@ -1250,32 +1250,36 @@
 ation%22;%0A        
+    
 String justifica
@@ -1327,32 +1327,36 @@
 erent%22;%0A        
+  
+  
 justificationMak
@@ -1399,33 +1399,68 @@
 tion2);%0A    
-%7D%09%0A%0A    @
+    %7D);%0A%0A    %7D%09%0A%0A    @org.junit.jupiter.api.
 Test%0A    pub
@@ -1757,32 +1757,54 @@
 %7D%0A        %0A    @
+org.junit.jupiter.api.
 Test%0A    public 
@@ -2094,24 +2094,46 @@
    %7D%09%0A%0A    @
+org.junit.jupiter.api.
 Test%0A    pub
@@ -2227,17 +2227,16 @@
 CHI_KEY,
- 
 %0A       
@@ -2315,32 +2315,54 @@
 ));%0A    %7D%0A%0A    @
+org.junit.jupiter.api.
 Test%0A    public 
@@ -2565,24 +2565,46 @@
     %7D%0A%0A    @
+org.junit.jupiter.api.
 Test%0A    pub
@@ -2815,24 +2815,46 @@
 %7D%0A    %0A    @
+org.junit.jupiter.api.
 Test%0A    pub
@@ -3055,24 +3055,7 @@
    %7D
-%0A%0A    %0A        %0A%09
 %0A%7D%0A

Update OpsJustificationMakerTest.java