### Question:
RailsEndpointMappings implements EndpointGenerator { @Nonnull @Override public List<Endpoint> generateEndpoints() { return endpoints; } RailsEndpointMappings(@Nonnull File rootDirectory); @Nonnull @Override List<Endpoint> generateEndpoints(); @Override Iterator<Endpoint> iterator(); String getRelativePath(File f);  }### Answer:
@Test public void testRailsGoatControllerParser() { File f = new File (TestConstants.RAILSGOAT_SOURCE_LOCATION); assert f.exists() : "Source code location does not exist. " + TestConstants.RAILSGOAT_SOURCE_LOCATION; assert f.isDirectory() : "Source code location is not folder. " + TestConstants.RAILSGOAT_SOURCE_LOCATION; RailsEndpointMappings mappings = new RailsEndpointMappings(f); List<Endpoint> endpoints = mappings.generateEndpoints(); assert !endpoints.isEmpty() : "Got empty endpoints for " + TestConstants.RAILSGOAT_SOURCE_LOCATION; Endpoint testEndpoint = new RailsEndpoint( "/app/controllers/password_resets_controller.rb", "/password_resets", "POST", map("confirm_password", RouteParameter.fromDataType("confirm_password", ParameterDataType.STRING), "password", RouteParameter.fromDataType("password", ParameterDataType.STRING), "user", RouteParameter.fromDataType("user", ParameterDataType.STRING)) ); confirmEndpointExistsIn(testEndpoint, endpoints); }
@Test public void testRailsGoatControllerParser() { File f = new File (TestConstants.RAILSGOAT_SOURCE_LOCATION); assert f.exists() : "Source code location does not exist. " + TestConstants.RAILSGOAT_SOURCE_LOCATION; assert f.isDirectory() : "Source code location is not folder. " + TestConstants.RAILSGOAT_SOURCE_LOCATION; RailsEndpointMappings mappings = new RailsEndpointMappings(f); List<Endpoint> endpoints = mappings.generateEndpoints(); assert !endpoints.isEmpty() : "Got empty endpoints for " + TestConstants.RAILSGOAT_SOURCE_LOCATION; Endpoint testEndpoint = new RailsEndpoint( "/app/controllers/password_resets_controller.rb", "/forgot_password", set("GET"), set("confirm_password", "email", "token", "password", "user") ); confirmEndpointExistsIn(testEndpoint, endpoints); }