test/src/kbasesearchengine/test/parse/ObjectParserTest.java
@Test
    public void parseSubObjectsGenomeFeatureTest() throws Exception {

        final String jsonResource = "genome01";
        final String type = "GenomeFeature";
        final String guid = "WS:1/1/1";

        final Map<GUID, String> guidToJson = parseSubObjects(type, jsonResource, guid);

        assertThat(guidToJson.size(), is(3));

        final List<String> expectedIds = Arrays.asList("NewGenome.CDS.6211", "NewGenome.CDS.6210",
                "NewGenome.CDS.6209");
        int key_index = 0;
        for (GUID guidKey : guidToJson.keySet()) {
            assertThat(guidKey.getSubObjectId(), is(expectedIds.get(key_index)));
            assertThat(guidKey.getSubObjectType(), is("feature"));
            assertThat(guidKey.getStorageCode(), is("WS"));
            assertThat(guidKey.getVersion(), is(1));
            assertThat(guidKey.getAccessGroupId(), is(1));
            assertThat(guidKey.getAccessGroupObjectId(), is("1"));
            key_index++;
        }

        final List<String> expectedKeys = Arrays.asList("ontology_terms", "function",
                "protein_translation", "location", "id", "type");
        final List<String> expectedFunctions = Arrays.asList("Polysaccharide biosynthesis protein",
                "Transcriptional activator RfaH", "Di-tripeptide/cation symporter");
        final String expectedType = "CDS";
        int value_index = 0;
        for (String jsonString : guidToJson.values()) {
            @SuppressWarnings("unchecked")
            HashMap<String, Object> result = new ObjectMapper().readValue(jsonString,
                    HashMap.class);
            assertThat(expectedKeys.containsAll(result.keySet()), is(true));
            assertThat(result.get("id"), is(expectedIds.get(value_index)));
            assertThat(result.get("function"), is(expectedFunctions.get(value_index)));
            assertThat(result.get("type"), is(expectedType));
            value_index++;
        }
    }
/**
     * Testing parsing GenomeFeature object
     * 
     * @throws Exception
     */
Testing parsing GenomeFeature object

@throws Exception
Testing parsing GenomeFeature object @throws Exception
@Test
    public void parseSubObjectsGenomeFeatureTest() throws Exception {
        final String jsonResource = "genome01";
        final String type = "GenomeFeature";
        final String guid = "WS:1/1/1";
        final Map<GUID, String> guidToJson = parseSubObjects(type, jsonResource, guid);
        assertThat(guidToJson.size(), is(3));
        final List<String> expectedIds = Arrays.asList("NewGenome.CDS.6211", "NewGenome.CDS.6210",
                "NewGenome.CDS.6209");
        int key_index = 0;
        for (GUID guidKey : guidToJson.keySet()) {
            assertThat(guidKey.getSubObjectId(), is(expectedIds.get(key_index)));
            assertThat(guidKey.getSubObjectType(), is("feature"));
            assertThat(guidKey.getStorageCode(), is("WS"));
            assertThat(guidKey.getVersion(), is(1));
            assertThat(guidKey.getAccessGroupId(), is(1));
            assertThat(guidKey.getAccessGroupObjectId(), is("1"));
            key_index++;
        }
        final List<String> expectedKeys = Arrays.asList("ontology_terms", "function",
                "protein_translation", "location", "id", "type");
        final List<String> expectedFunctions = Arrays.asList("Polysaccharide biosynthesis protein",
                "Transcriptional activator RfaH", "Di-tripeptide/cation symporter");
        final String expectedType = "CDS";
        int value_index = 0;
        for (String jsonString : guidToJson.values()) {
            @SuppressWarnings("unchecked")
            HashMap<String, Object> result = new ObjectMapper().readValue(jsonString,
                    HashMap.class);
            assertThat(expectedKeys.containsAll(result.keySet()), is(true));
            assertThat(result.get("id"), is(expectedIds.get(value_index)));
            assertThat(result.get("function"), is(expectedFunctions.get(value_index)));
            assertThat(result.get("type"), is(expectedType));
            value_index++;
        }
    }
@ Test public void parseSubObjectsGenomeFeatureTest ( ) throws Exception { final String jsonResource = "genome01" ; final String type = "GenomeFeature" ; final String guid = "WS:1/1/1" ; final Map < GUID , String > guidToJson = parseSubObjects ( type , jsonResource , guid ) ; assertThat ( guidToJson . size ( ) , is ( 3 ) ) ; final List < String > expectedIds = Arrays . asList ( "NewGenome.CDS.6211" , "NewGenome.CDS.6210" , "NewGenome.CDS.6209" ) ; int key_index = 0 ; for ( GUID guidKey : guidToJson . keySet ( ) ) { assertThat ( guidKey . getSubObjectId ( ) , is ( expectedIds . get ( key_index ) ) ) ; assertThat ( guidKey . getSubObjectType ( ) , is ( "feature" ) ) ; assertThat ( guidKey . getStorageCode ( ) , is ( "WS" ) ) ; assertThat ( guidKey . getVersion ( ) , is ( 1 ) ) ; assertThat ( guidKey . getAccessGroupId ( ) , is ( 1 ) ) ; assertThat ( guidKey . getAccessGroupObjectId ( ) , is ( "1" ) ) ; key_index ++ ; } final List < String > expectedKeys = Arrays . asList ( "ontology_terms" , "function" , "protein_translation" , "location" , "id" , "type" ) ; final List < String > expectedFunctions = Arrays . asList ( "Polysaccharide biosynthesis protein" , "Transcriptional activator RfaH" , "Di-tripeptide/cation symporter" ) ; final String expectedType = "CDS" ; int value_index = 0 ; for ( String jsonString : guidToJson . values ( ) ) { @ SuppressWarnings ( "unchecked" ) HashMap < String , Object > result = new ObjectMapper ( ) . readValue ( jsonString , HashMap . class ) ; assertThat ( expectedKeys . containsAll ( result . keySet ( ) ) , is ( true ) ) ; assertThat ( result . get ( "id" ) , is ( expectedIds . get ( value_index ) ) ) ; assertThat ( result . get ( "function" ) , is ( expectedFunctions . get ( value_index ) ) ) ; assertThat ( result . get ( "type" ) , is ( expectedType ) ) ; value_index ++ ; } }
Testing parsing GenomeFeature object
Testing parsing GenomeFeature object