diff --git a/fkl_cli/src/deconstruct/model_builder.rs b/fkl_cli/src/deconstruct/model_builder.rs index 8831d9d..ba53de1 100644 --- a/fkl_cli/src/deconstruct/model_builder.rs +++ b/fkl_cli/src/deconstruct/model_builder.rs @@ -47,7 +47,7 @@ impl ModelBuilder { match ext { "java" => { - let mut file = Self::by_str(path); + let mut file = Self::by_str(ModelBuilder::read_content(path).as_str()); file.path = ModelBuilder::format_path(path); file.file_name = file_name.to_string(); file.pure_name = file_name.replace(".java", ""); @@ -57,8 +57,8 @@ impl ModelBuilder { } } - fn by_str(path: &Path) -> CodeFile { - JavaConstruct::parse(ModelBuilder::read_content(path).as_str()) + pub fn by_str(content: &str) -> CodeFile { + JavaConstruct::parse(content) } fn read_content(path: &Path) -> String { diff --git a/fkl_cli/src/generator/mod.rs b/fkl_cli/src/generator/mod.rs index e678a3d..7a29ba9 100644 --- a/fkl_cli/src/generator/mod.rs +++ b/fkl_cli/src/generator/mod.rs @@ -1,8 +1,25 @@ /// #[cfg(test)] mod tests { + use crate::deconstruct::model_builder::ModelBuilder; + #[test] fn it_works() { - + let code_file = ModelBuilder::by_str(r#" +@RestController +@Transactional + +public class ApplicationController { + @PostMapping("/client/manager") + public ResponseEntity addAccountManager(@RequestBody final AddAccountManagerCommand command, + @ApiParam(hidden = true) final HttpMethod method, final WebRequest request) { + + final AccountAccessResource result = new AccountAccessResource(); + return new ResponseEntity<>(result, HttpStatus.CREATED); + } +} + "#); + + println!("{:?}", code_file); } }