public static Fixture parseFrom ( String fileName , Parser parser ) { if ( fileName == null ) { throw new NullPointerException ( "File name should not be null" ) ; } String path = "fixtures/" + fileName + ".yaml" ; InputStream inputStream = openPathAsStream ( path ) ; Fixture result = parser . parse ( inputStream ) ; if ( result . body != null && ! result . body . startsWith ( "{" ) ) { String bodyPath = "fixtures/" + result . body ; try { result . body = readPathIntoString ( bodyPath ) ; } catch ( IOException e ) { throw new IllegalStateException ( "Error reading body: " + bodyPath , e ) ; } } return result ; }
Parse the given filename and returns the Fixture object .