SwaggerService { public Api importApiFromSwaggerJSON(Api api, String swaggerAsString, boolean override) throws IOException { List<Resource> resources; if (override) { resourceService.deleteAllFromApi(api.getId()); resources = new ArrayList<>(); } else { resources = resourceService.list(api.getId(), new ResourceDTO()); } Swagger swagger = new Swagger20Parser().parse(swaggerAsString); readTags(swagger.getTags(), resources, api.getId()); readPaths(swagger.getPaths(), api.getBasePath(), resources, api.getId()); api.setResources(new HashSet<>(resources)); return api; }  Swagger exportApiToSwaggerJSON(Api api); Api importApiFromSwaggerJSON(Api api, String swaggerAsString, boolean override);  }
@Test public void importApiFromSwaggerJSONWithoutOverride() throws IOException { importApiFromSwaggerJSON(false); }
@Test public void importApiFromSwaggerJSONWithOverride() throws IOException { importApiFromSwaggerJSON(true); }