Skip to content

Commit d72044d

Browse files
committed
Added severtiy to notfications test in result api steps
1 parent 761753d commit d72044d

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

driver/src/test/java/org/neo4j/driver/v1/tck/DriverResultApiSteps.java

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/**
22
* Copyright (c) 2002-2016 "Neo Technology,"
33
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4-
* <p>
4+
*
55
* This file is part of Neo4j.
6-
* <p>
6+
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
99
* You may obtain a copy of the License at
10-
* <p>
11-
* http://www.apache.org/licenses/LICENSE-2.0
12-
* <p>
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
1313
* Unless required by applicable law or agreed to in writing, software
1414
* distributed under the License is distributed on an "AS IS" BASIS,
1515
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -257,16 +257,16 @@ public void theSummaryHasNotifications( DataTable table ) throws Throwable
257257
switch ( key )
258258
{
259259
case "code":
260-
assertThat( expected.get( key ), IsInstanceOf.instanceOf( notification.code().getClass() ) );
261-
assertThat( expected.get( key ), CoreMatchers.<Object>equalTo( notification.code() ) );
260+
compareNotificationValue( notification.code(), expected.get( key ) );
262261
break;
263262
case "title":
264-
assertThat( expected.get( key ), IsInstanceOf.instanceOf( notification.title().getClass() ) );
265-
assertThat( expected.get( key ), CoreMatchers.<Object>equalTo( notification.title() ) );
263+
compareNotificationValue( notification.title(), expected.get( key ) );
266264
break;
267265
case "description":
268-
assertThat( expected.get( key ), IsInstanceOf.instanceOf( notification.description().getClass() ) );
269-
assertThat( expected.get( key ), CoreMatchers.<Object>equalTo( notification.description() ) );
266+
compareNotificationValue( notification.description(), expected.get( key ) );
267+
break;
268+
case "severity":
269+
compareNotificationValue( notification.severity(), expected.get( key ) );
270270
break;
271271
case "position":
272272
Map<String,Object> expectedPosition = (Map<String,Object>) expected.get( key );
@@ -276,25 +276,33 @@ public void theSummaryHasNotifications( DataTable table ) throws Throwable
276276
switch ( positionKey )
277277
{
278278
case "offset":
279-
assertThat( expectedPosition.get( positionKey ),
280-
CoreMatchers.<Object>equalTo( position.offset() ) );
279+
compareNotificationValue( position.offset(), expectedPosition.get( positionKey ) );
281280
break;
282281
case "line":
283-
assertThat( expectedPosition.get( positionKey ),
284-
CoreMatchers.<Object>equalTo( position.line() ) );
282+
compareNotificationValue( position.line(), expectedPosition.get( positionKey ) );
285283
break;
286284
case "column":
287-
assertThat( expectedPosition.get( positionKey ),
288-
CoreMatchers.<Object>equalTo( position.column() ) );
285+
compareNotificationValue( position.column(), expectedPosition.get( positionKey ) );
289286
break;
290287
}
291288
}
289+
break;
290+
default:
291+
throw new IllegalArgumentException( "No case for " + key );
292292
}
293293

294+
295+
294296
}
295297
}
296298
}
297299

300+
private void compareNotificationValue(Object given, Object expected )
301+
{
302+
assertThat( given, IsInstanceOf.instanceOf( expected.getClass() ) );
303+
assertThat( given, CoreMatchers.<Object>equalTo( expected ) );
304+
}
305+
298306
public HashMap<String,Object> tableToValueMap( DataTable table )
299307
{
300308
HashMap<String,Object> map = new HashMap<>();

0 commit comments

Comments
 (0)