Skip to content

Commit

Permalink
[#51] Add return type to signature field
Browse files Browse the repository at this point in the history
  • Loading branch information
fbiville committed Apr 2, 2017
1 parent 444a4cb commit 6195eda
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public Either<DsvExportError,String> qualifiedName(ExecutableElement method )

public Either<DsvExportError,String> signature(ExecutableElement method )
{
return Either.right(String.format("%s(%s)", method.getSimpleName(), parameters(method)));
return Either.right(String.format("%s %s(%s)", returnType(method), method.getSimpleName(), parameters(method)));
}

public Either<DsvExportError,String> description( ExecutableElement method )
Expand Down Expand Up @@ -149,6 +149,10 @@ public Either<DsvExportError,String> deprecatedBy( ExecutableElement method )
return Either.right( method.getAnnotation( Procedure.class ).deprecatedBy() );
}

private String returnType(ExecutableElement method) {
return method.getReturnType().toString();
}

private String callableName( ExecutableElement method )
{
Supplier<String> defaultName =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public void dumps_procedure_definition_to_dsv_with_custom_delimiter_and_package_
String generatedCsv = readContents(Paths.get(folder.getAbsolutePath(), namespace + ".csv"));
assertThat(generatedCsv).isEqualTo(
"\"type\"|\"qualified name\"|\"signature\"|\"description\"|\"execution mode\"|\"location\"|\"deprecated by\"\n" +
"\"procedure\"|\"" + namespace + ".doSomething\"|\"doSomething(int foo)\"|\"\"|\"PERFORMS_WRITE\"|\"" + namespace + ".SimpleProcedures\"|\"doSomething2\"\n" +
"\"procedure\"|\"" + namespace + ".doSomething2\"|\"doSomething2(long bar)\"|\"Much better than the former version\"|\"SCHEMA\"|\"" + namespace + ".SimpleProcedures\"|\"\"\n" +
"\"procedure\"|\"" + namespace + ".doSomething3\"|\"doSomething3(LongWrapper bar)\"|\"Much better with records\"|\"SCHEMA\"|\"" + namespace + ".SimpleProcedures\"|\"\"\n" +
"\"function\"|\"" + namespace + ".sum\"|\"sum(int a,int b)\"|\"Performs super complex maths\"|\"\"|\"" + namespace + ".SimpleUserFunctions\"|\"\"");
"\"procedure\"|\"" + namespace + ".doSomething\"|\"void doSomething(int foo)\"|\"\"|\"PERFORMS_WRITE\"|\"" + namespace + ".SimpleProcedures\"|\"doSomething2\"\n" +
"\"procedure\"|\"" + namespace + ".doSomething2\"|\"void doSomething2(long bar)\"|\"Much better than the former version\"|\"SCHEMA\"|\"" + namespace + ".SimpleProcedures\"|\"\"\n" +
"\"procedure\"|\"" + namespace + ".doSomething3\"|\"void doSomething3(LongWrapper bar)\"|\"Much better with records\"|\"SCHEMA\"|\"" + namespace + ".SimpleProcedures\"|\"\"\n" +
"\"function\"|\"" + namespace + ".sum\"|\"long sum(int a,int b)\"|\"Performs super complex maths\"|\"\"|\"" + namespace + ".SimpleUserFunctions\"|\"\"");
}

@Test
Expand All @@ -91,10 +91,10 @@ public void dumps_procedure_definition_to_dsv_with_custom_delimiter_and_package_
String generatedCsv = readContents(Paths.get(folder.getAbsolutePath(), namespace + ".csv"));
assertThat(generatedCsv).isEqualTo(
"|\"type\"|\"qualified name\"|\"signature\"|\"description\"|\"execution mode\"|\"location\"|\"deprecated by\"\n" +
"|\"procedure\"|\"" + namespace + ".doSomething\"|\"doSomething(int foo)\"|\"\"|\"PERFORMS_WRITE\"|\"" + namespace + ".SimpleProcedures\"|\"doSomething2\"\n" +
"|\"procedure\"|\"" + namespace + ".doSomething2\"|\"doSomething2(long bar)\"|\"Much better than the former version\"|\"SCHEMA\"|\"" + namespace + ".SimpleProcedures\"|\"\"\n" +
"|\"procedure\"|\"" + namespace + ".doSomething3\"|\"doSomething3(LongWrapper bar)\"|\"Much better with records\"|\"SCHEMA\"|\"" + namespace + ".SimpleProcedures\"|\"\"\n" +
"|\"function\"|\"" + namespace + ".sum\"|\"sum(int a,int b)\"|\"Performs super complex maths\"|\"\"|\"" + namespace + ".SimpleUserFunctions\"|\"\"");
"|\"procedure\"|\"" + namespace + ".doSomething\"|\"void doSomething(int foo)\"|\"\"|\"PERFORMS_WRITE\"|\"" + namespace + ".SimpleProcedures\"|\"doSomething2\"\n" +
"|\"procedure\"|\"" + namespace + ".doSomething2\"|\"void doSomething2(long bar)\"|\"Much better than the former version\"|\"SCHEMA\"|\"" + namespace + ".SimpleProcedures\"|\"\"\n" +
"|\"procedure\"|\"" + namespace + ".doSomething3\"|\"void doSomething3(LongWrapper bar)\"|\"Much better with records\"|\"SCHEMA\"|\"" + namespace + ".SimpleProcedures\"|\"\"\n" +
"|\"function\"|\"" + namespace + ".sum\"|\"long sum(int a,int b)\"|\"Performs super complex maths\"|\"\"|\"" + namespace + ".SimpleUserFunctions\"|\"\"");
}

@Test
Expand Down

0 comments on commit 6195eda

Please sign in to comment.