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

        final String jsonResource = "fbamodel01";
        final String type = "ModelReactionProteinSubunit";
        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("allantoate deiminase (EC 3.5.3.9)", 
                "Dihydropteroate synthase (EC 2.5.1.15)",
                "Glutathione synthetase (EC 6.3.2.3)");
        int key_index = 0;
        for (GUID guidKey : guidToJson.keySet()) {
            assertThat(guidKey.getSubObjectId(), is(expectedIds.get(key_index)));
            assertThat(guidKey.getSubObjectType(), is("ModelReactionProteinSubunit"));
            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("role", "feature_refs");
        final List<List<String>> expectedName = Arrays.asList(
                Arrays.asList("~/genome/features/id/eco_from_assembly.CDS.522"), 
                Arrays.asList("~/genome/features/id/eco_from_assembly.CDS.3263"), 
                Arrays.asList("~/genome/features/id/eco_from_assembly.CDS.3031"));
        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("role"), is(expectedIds.get(value_index)));
            assertThat(result.get("feature_refs"), is(expectedName.get(value_index)));
            value_index++;
        }
    }
/**
     * Testing parsing ModelReactionProteinSubunit object
     *
     * @throws Exception
     */
Testing parsing ModelReactionProteinSubunit object
@throws Exception
Testing parsing ModelReactionProteinSubunit object @throws Exception
@Test
    public void parseSubObjectsModelReactionProteinSubunitTest() throws Exception {
        final String jsonResource = "fbamodel01";
        final String type = "ModelReactionProteinSubunit";
        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("allantoate deiminase (EC 3.5.3.9)", 
                "Dihydropteroate synthase (EC 2.5.1.15)",
                "Glutathione synthetase (EC 6.3.2.3)");
        int key_index = 0;
        for (GUID guidKey : guidToJson.keySet()) {
            assertThat(guidKey.getSubObjectId(), is(expectedIds.get(key_index)));
            assertThat(guidKey.getSubObjectType(), is("ModelReactionProteinSubunit"));
            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("role", "feature_refs");
        final List<List<String>> expectedName = Arrays.asList(
                Arrays.asList("~/genome/features/id/eco_from_assembly.CDS.522"), 
                Arrays.asList("~/genome/features/id/eco_from_assembly.CDS.3263"), 
                Arrays.asList("~/genome/features/id/eco_from_assembly.CDS.3031"));
        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("role"), is(expectedIds.get(value_index)));
            assertThat(result.get("feature_refs"), is(expectedName.get(value_index)));
            value_index++;
        }
    }
@ Test public void parseSubObjectsModelReactionProteinSubunitTest ( ) throws Exception { final String jsonResource = "fbamodel01" ; final String type = "ModelReactionProteinSubunit" ; 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 ( "allantoate deiminase (EC 3.5.3.9)" , "Dihydropteroate synthase (EC 2.5.1.15)" , "Glutathione synthetase (EC 6.3.2.3)" ) ; int key_index = 0 ; for ( GUID guidKey : guidToJson . keySet ( ) ) { assertThat ( guidKey . getSubObjectId ( ) , is ( expectedIds . get ( key_index ) ) ) ; assertThat ( guidKey . getSubObjectType ( ) , is ( "ModelReactionProteinSubunit" ) ) ; 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 ( "role" , "feature_refs" ) ; final List < List < String > > expectedName = Arrays . asList ( Arrays . asList ( "~/genome/features/id/eco_from_assembly.CDS.522" ) , Arrays . asList ( "~/genome/features/id/eco_from_assembly.CDS.3263" ) , Arrays . asList ( "~/genome/features/id/eco_from_assembly.CDS.3031" ) ) ; 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 ( "role" ) , is ( expectedIds . get ( value_index ) ) ) ; assertThat ( result . get ( "feature_refs" ) , is ( expectedName . get ( value_index ) ) ) ; value_index ++ ; } }
Testing parsing ModelReactionProteinSubunit object
 @throws Exception
Testing parsing ModelReactionProteinSubunit object @throws Exception