assertj / assertj/assertj-db

How to check value on a Postgres JsonB field?

オープン
#101 コメント 3 件 リアクション 0 件 担当者 1 名 @VanRoy が担当を希望しています GitHub で見る
enhancement question
主要言語
Java
スター
130
フォーク
21
PR マージ指標
30日以内にマージされた PR はありません

説明

I trying to check the values inserted on a table where a field is of the type `jsonb`.

When I run something like this:
```java
assertThat(eventsTable)
.row(0)
.value("data").isEqualTo("{\"key\": \"value\"}");
```
I get the following error:
```
[Value at index 0 (column name : DATA) of Row at index 0 of events table]
Expecting:
<{"key": "value"}>
to be of type
<[TEXT, NUMBER, DATE, TIME, DATE_TIME, UUID]>
but was of type
(org.postgresql.util.PGobject)
```

Here is the table content:
```
[events table]
|-----------|---------|-------------------------------------------------------|
| | | |
| | PRIMARY | DATA |
| | KEY | (NOT_IDENTIFIED : class org.postgresql.util.PGobject) |
| | | Index : 0 |
|-----------|---------|-------------------------------------------------------|
| Index : 0 | | {"key": "value"} |
|-----------|---------|-------------------------------------------------------|
```
Using assertj-db 2.0.0

Is there any way I can check the content of a PostgreSQL `jsonb` column?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。