Skip to content

Commit

Permalink
story 959 task-5036: bug fix (finos#817)
Browse files Browse the repository at this point in the history
* task-5036: bug fix

* task-5036: verification unit test
  • Loading branch information
ja6a-regnosys authored Aug 29, 2024
1 parent 40b12c3 commit ef78afb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public Optional<? extends Object> getValue() {
}
@Override
public String toString() {
return String.format("<%s, %s, alreadyReferenced [%b], referencedField [%s]>", field.getName(), value.map(Object::toString).orElse("<empty>"));
return String.format("<%s, %s>", field.getName(), value.map(Object::toString).orElse("<empty>"));
}
@Override
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,4 +730,34 @@ class TabulatorTest {
'''
assertFieldValuesEqual(expectedValues, flatReport)
}
}

@Test
def void confirmToString() {
val model = '''
«HEADER»
type ReportableInput:
title string (1..1)
type Report:
basic string (1..1)
[ruleReference Basic]
reporting rule Basic from ReportableInput:
extract title
'''
val code = model.generateCode

val reportId = new ModelReportId(DottedPath.splitOnDots("com.rosetta.test.model"), "TEST_REG", "Corp")
val tabulatorClass = reportId.toJavaReportTabulator
val classes = code.compileToClasses
val tabulator = classes.<Tabulator<RosettaModelObject>>createInstance(tabulatorClass)
val report = classes.createInstanceUsingBuilder("Report", #{"basic" -> "My reportable input"})
val actual = tabulator.tabulate(report)

val expected = "[<basic, My reportable input>]"

assertEquals(actual.toString(), expected)
}
}

0 comments on commit ef78afb

Please sign in to comment.