Skip to content

Commit

Permalink
test: Extend test case for boolean (asyncapi#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
JapuDCret committed May 19, 2023
1 parent fba26f7 commit 3fa7e8b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
19 changes: 18 additions & 1 deletion tests/__snapshots__/map-format.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class SongMetaData {
private @Valid Map<String, Long> stats;
private @Valid Map<String, Boolean> flags;
private @Valid Album album;
private @Valid Map<String, Interpret> interprets;
Expand Down Expand Up @@ -54,6 +56,19 @@ public class SongMetaData {
}
/**
* Flags
*/
@JsonProperty(\\"flags\\")
public Map<String, Boolean> getFlags() {
return flags;
}
public void setFlags(Map<String, Boolean> flags) {
this.flags = flags;
}
/**
* Album
*/
Expand Down Expand Up @@ -91,13 +106,14 @@ public class SongMetaData {
return
Objects.equals(this.tags, songMetaData.tags) &&
Objects.equals(this.stats, songMetaData.stats) &&
Objects.equals(this.flags, songMetaData.flags) &&
Objects.equals(this.album, songMetaData.album) &&
Objects.equals(this.interprets, songMetaData.interprets);
}
@Override
public int hashCode() {
return Objects.hash(tags, stats, album, interprets);
return Objects.hash(tags, stats, flags, album, interprets);
}
@Override
Expand All @@ -106,6 +122,7 @@ public class SongMetaData {
\\" tags: \\" + toIndentedString(tags) + \\"\\\\n\\" +
\\" stats: \\" + toIndentedString(stats) + \\"\\\\n\\" +
\\" flags: \\" + toIndentedString(flags) + \\"\\\\n\\" +
\\" album: \\" + toIndentedString(album) + \\"\\\\n\\" +
\\" interprets: \\" + toIndentedString(interprets) + \\"\\\\n\\" +
\\"}\\";
Expand Down
2 changes: 1 addition & 1 deletion tests/map-format.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('template integration tests for map format', () => {
await generator.generateFromFile(path.resolve('tests', mapFormatExamplePath));

const expectedFiles = [
'/src/main/java/com/asyncapi/model/SongMetaData.java'
'/src/main/java/com/asyncapi/model/SongMetaData.java',
];
for (const index in expectedFiles) {
const file = await readFile(path.join(outputDir, expectedFiles[index]), 'utf8');
Expand Down
4 changes: 4 additions & 0 deletions tests/mocks/map-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ components:
additionalProperties:
type: integer
format: int64
flags:
description: Flags
additionalProperties:
type: boolean
album:
$ref: '#/components/schemas/Album'
interprets:
Expand Down

0 comments on commit 3fa7e8b

Please sign in to comment.