@@ -58,19 +58,19 @@ class DsnTest {
5858 @Test
5959 fun `when no project id exists, throws exception` () {
6060 val ex = assertFailsWith<IllegalArgumentException > { Dsn (" http://key@host/" ) }
61- assertThat(ex.message ).isEqualTo(" Invalid DSN: A Project Id is required." )
61+ assertThat(ex).hasMessageThat( ).isEqualTo(" Invalid DSN: A Project Id is required." )
6262 }
6363
6464 @Test
6565 fun `when no key exists, throws exception` () {
6666 val ex = assertFailsWith<IllegalArgumentException > { Dsn (" http://host/id" ) }
67- assertThat(ex.message ).isEqualTo(" Invalid DSN: No public key provided." )
67+ assertThat(ex).hasMessageThat( ).isEqualTo(" Invalid DSN: No public key provided." )
6868 }
6969
7070 @Test
7171 fun `when only passing secret key, throws exception` () {
7272 val ex = assertFailsWith<IllegalArgumentException > { Dsn (" https://:secret@host/path/id" ) }
73- assertThat(ex.message ).isEqualTo(" Invalid DSN: No public key provided." )
73+ assertThat(ex).hasMessageThat( ).isEqualTo(" Invalid DSN: No public key provided." )
7474 }
7575
7676 @Test
@@ -88,19 +88,24 @@ class DsnTest {
8888 @Test
8989 fun `when dsn is empty, throws exception` () {
9090 val ex = assertFailsWith<IllegalArgumentException > { Dsn (" " ) }
91- assertThat(ex.message ).isEqualTo(" The DSN is empty." )
91+ assertThat(ex).hasMessageThat( ).isEqualTo(" The DSN is empty." )
9292 }
9393
9494 @Test
9595 fun `when dsn is only whitespace, throws exception` () {
9696 val ex = assertFailsWith<IllegalArgumentException > { Dsn (" " ) }
97- assertThat(ex.message ).isEqualTo(" The DSN is empty." )
97+ assertThat(ex).hasMessageThat( ).isEqualTo(" The DSN is empty." )
9898 }
9999
100100 @Test
101101 fun `non http protocols are not accepted` () {
102- assertFailsWith<IllegalArgumentException > { Dsn (" ftp://publicKey:secretKey@host/path/id" ) }
103- assertFailsWith<IllegalArgumentException > { Dsn (" jar://publicKey:secretKey@host/path/id" ) }
102+ val ftp =
103+ assertFailsWith<IllegalArgumentException > { Dsn (" ftp://publicKey:secretKey@host/path/id" ) }
104+ assertThat(ftp).hasMessageThat().isEqualTo(" Invalid DSN: Invalid scheme 'ftp'." )
105+
106+ val jar =
107+ assertFailsWith<IllegalArgumentException > { Dsn (" jar://publicKey:secretKey@host/path/id" ) }
108+ assertThat(jar).hasMessageThat().isEqualTo(" Invalid DSN: Invalid scheme 'jar'." )
104109 }
105110
106111 @Test
@@ -138,17 +143,20 @@ class DsnTest {
138143
139144 @Test
140145 fun `when dsn is null, throws exception` () {
141- assertFailsWith<IllegalArgumentException > { Dsn (null ) }
146+ val ex = assertFailsWith<IllegalArgumentException > { Dsn (null ) }
147+ assertThat(ex).hasMessageThat().isEqualTo(" The DSN is required." )
142148 }
143149
144150 @Test
145151 fun `when dsn has no scheme separator, throws exception` () {
146- assertFailsWith<IllegalArgumentException > { Dsn (" httpspublicKey@host/id" ) }
152+ val ex = assertFailsWith<IllegalArgumentException > { Dsn (" httpspublicKey@host/id" ) }
153+ assertThat(ex).hasMessageThat().isEqualTo(" Invalid DSN: Missing scheme." )
147154 }
148155
149156 @Test
150157 fun `when dsn has no slash after host, throws exception` () {
151- assertFailsWith<IllegalArgumentException > { Dsn (" https://key@host" ) }
158+ val ex = assertFailsWith<IllegalArgumentException > { Dsn (" https://key@host" ) }
159+ assertThat(ex).hasMessageThat().isEqualTo(" Invalid DSN: A Project Id is required." )
152160 }
153161
154162 @Test
0 commit comments