test/src/kbasesearchengine/test/parse/ObjectParserTest.java
public static ArrayList<GUID> prepareGUID(String type, String jsonResource, GUID ref)
            throws Exception {

        final ArrayList<GUID> idList = new ArrayList<GUID>();

        final File rulesFile = new File("resources/types/" + type + ".yaml");
        final ObjectTypeParsingRules parsingRules = ObjectTypeParsingRulesFileParser
                .fromFile(rulesFile).get(0);
        final Map<ObjectJsonPath, String> pathToJson = new LinkedHashMap<>();
        final SubObjectConsumer subObjConsumer = new SimpleSubObjectConsumer(pathToJson);

        try (JsonParser jts = SubObjectExtractorTest.getParsedJsonResource(jsonResource)) {
            ObjectParser.extractSubObjects(parsingRules, subObjConsumer, jts);
        }

        for (ObjectJsonPath path : pathToJson.keySet()) {
            final String subJson = pathToJson.get(path);
            final SimpleIdConsumer idConsumer = new SimpleIdConsumer();
            if (parsingRules.getSubObjectIDPath().isPresent()) {
                try (JsonParser subJts = UObject.getMapper().getFactory().createParser(subJson)) {
                    IdMapper.mapKeys(parsingRules.getSubObjectIDPath().get(), subJts, idConsumer);
                }
            }
            final GUID id = ObjectParser.prepareGUID(parsingRules, ref, path, idConsumer);
            idList.add(id);
        }

        return idList;
    }
/**
     * Helper method for ObjectParser.prepareGUID tests
     * 
     * @param type
     * @param jsonResource
     * @param ref
     * @return
     * @throws Exception
     */
Helper method for ObjectParser.prepareGUID tests


Helper method for ObjectParser . prepareGUID tests
public static ArrayList<GUID> prepareGUID(String type, String jsonResource, GUID ref)
            throws Exception {
        final ArrayList<GUID> idList = new ArrayList<GUID>();
        final File rulesFile = new File("resources/types/" + type + ".yaml");
        final ObjectTypeParsingRules parsingRules = ObjectTypeParsingRulesFileParser
                .fromFile(rulesFile).get(0);
        final Map<ObjectJsonPath, String> pathToJson = new LinkedHashMap<>();
        final SubObjectConsumer subObjConsumer = new SimpleSubObjectConsumer(pathToJson);
        try (JsonParser jts = SubObjectExtractorTest.getParsedJsonResource(jsonResource)) {
            ObjectParser.extractSubObjects(parsingRules, subObjConsumer, jts);
        }
        for (ObjectJsonPath path : pathToJson.keySet()) {
            final String subJson = pathToJson.get(path);
            final SimpleIdConsumer idConsumer = new SimpleIdConsumer();
            if (parsingRules.getSubObjectIDPath().isPresent()) {
                try (JsonParser subJts = UObject.getMapper().getFactory().createParser(subJson)) {
                    IdMapper.mapKeys(parsingRules.getSubObjectIDPath().get(), subJts, idConsumer);
                }
            }
            final GUID id = ObjectParser.prepareGUID(parsingRules, ref, path, idConsumer);
            idList.add(id);
        }
        return idList;
    }
public static ArrayList < GUID > prepareGUID ( String type , String jsonResource , GUID ref ) throws Exception { final ArrayList < GUID > idList = new ArrayList < GUID > ( ) ; final File rulesFile = new File ( "resources/types/" + type + ".yaml" ) ; final ObjectTypeParsingRules parsingRules = ObjectTypeParsingRulesFileParser . fromFile ( rulesFile ) . get ( 0 ) ; final Map < ObjectJsonPath , String > pathToJson = new LinkedHashMap < > ( ) ; final SubObjectConsumer subObjConsumer = new SimpleSubObjectConsumer ( pathToJson ) ; try ( JsonParser jts = SubObjectExtractorTest . getParsedJsonResource ( jsonResource ) ) { ObjectParser . extractSubObjects ( parsingRules , subObjConsumer , jts ) ; } for ( ObjectJsonPath path : pathToJson . keySet ( ) ) { final String subJson = pathToJson . get ( path ) ; final SimpleIdConsumer idConsumer = new SimpleIdConsumer ( ) ; if ( parsingRules . getSubObjectIDPath ( ) . isPresent ( ) ) { try ( JsonParser subJts = UObject . getMapper ( ) . getFactory ( ) . createParser ( subJson ) ) { IdMapper . mapKeys ( parsingRules . getSubObjectIDPath ( ) . get ( ) , subJts , idConsumer ) ; } } final GUID id = ObjectParser . prepareGUID ( parsingRules , ref , path , idConsumer ) ; idList . add ( id ) ; } return idList ; }
Helper method for ObjectParser.prepareGUID tests
Helper method for ObjectParser . prepareGUID tests