package org.opencds.cqf.ruler.utility;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.Test;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;

public class IdsTest {
    @Test
    public void testAllVersionsSupported() {
        for (FhirVersionEnum fhirVersionEnum : FhirVersionEnum.values()) {
            Ids.newId(fhirVersionEnum, "Patient/123");
        }
    }

    @Test
    public void testContextSupported() {
        IIdType id = Ids.newId(FhirContext.forDstu3Cached(), "Patient/123");
        assertTrue(id instanceof org.hl7.fhir.dstu3.model.IdType);
    }

    @Test
    public void testPartsSupported() {
        IIdType id = Ids.newId(FhirVersionEnum.DSTU3, "Patient","123");
        assertTrue(id instanceof org.hl7.fhir.dstu3.model.IdType);

        assertEquals("Patient", id.getResourceType());
        assertEquals("123", id.getIdPart());
    }

    @Test
    public void testClassSupported() {
        IIdType id = Ids.newId(org.hl7.fhir.dstu3.model.Library.class, "123");
        assertTrue(id instanceof org.hl7.fhir.dstu3.model.IdType);
        assertEquals("Library", id.getResourceType());
        assertEquals("123", id.getIdPart());
    }   
}

@@ -346,30 +346,24 @@
 sTest %7B%0A
-    
+%09
 @Test%0A
-    
+%09
 public v
@@ -395,24 +395,18 @@
 ted() %7B%0A
-        
+%09%09
 for (Fhi
@@ -468,20 +468,11 @@
 ) %7B%0A
-            
+%09%09%09
 Ids.
@@ -514,39 +514,24 @@
 %22);%0A
-        %7D%0A    %7D%0A%0A    
+%09%09%7D%0A%09%7D%0A%0A%09
 @Test%0A
-    
+%09
 publ
@@ -559,32 +559,26 @@
 pported() %7B%0A
-        
+%09%09
 IIdType id =
@@ -630,32 +630,26 @@
 ient/123%22);%0A
-        
+%09%09
 assertTrue(i
@@ -695,37 +695,28 @@
 dType);%0A
-    %7D%0A%0A    
+%09%7D%0A%0A%09
 @Test%0A
-    
+%09
 public v
@@ -738,32 +738,26 @@
 pported() %7B%0A
-        
+%09%09
 IIdType id =
@@ -800,24 +800,25 @@
 atient%22,
+ 
 %22123%22);%0A
         
@@ -805,32 +805,26 @@
 t%22, %22123%22);%0A
-        
+%09%09
 assertTrue(i
@@ -871,24 +871,18 @@
 Type);%0A%0A
-        
+%09%09
 assertEq
@@ -916,32 +916,26 @@
 rceType());%0A
-        
+%09%09
 assertEquals
@@ -963,29 +963,20 @@
 ));%0A
-    %7D%0A%0A    
+%09%7D%0A%0A%09
 @Test%0A
-    
+%09
 publ
@@ -1006,24 +1006,18 @@
 ted() %7B%0A
-        
+%09%09
 IIdType 
@@ -1079,24 +1079,18 @@
 %22123%22);%0A
-        
+%09%09
 assertTr
@@ -1140,24 +1140,18 @@
 dType);%0A
-        
+%09%09
 assertEq
@@ -1193,16 +1193,10 @@
 ));%0A
-        
+%09%09
 asse
@@ -1232,15 +1232,9 @@
 ));%0A
-    %7D   
+%09%7D
 %0A%7D%0A

Fix spacing to address bug warning