36
36
37
37
/**
38
38
* Tests for {@link MongoHealthIndicator}.
39
- *
39
+ *
40
40
* @author Christian Dupuis
41
41
*/
42
42
public class MongoHealthIndicatorTests {
@@ -67,7 +67,7 @@ public void mongoIsUp() throws Exception {
67
67
CommandResult commandResult = Mockito .mock (CommandResult .class );
68
68
Mockito .when (commandResult .getString ("version" )).thenReturn ("2.6.4" );
69
69
MongoTemplate mongoTemplate = Mockito .mock (MongoTemplate .class );
70
- Mockito .when (mongoTemplate .executeCommand ("{ serverStatus : 1 }" )).thenReturn (
70
+ Mockito .when (mongoTemplate .executeCommand ("{ buildInfo : 1 }" )).thenReturn (
71
71
commandResult );
72
72
MongoHealthIndicator healthIndicator = new MongoHealthIndicator (mongoTemplate );
73
73
@@ -76,13 +76,13 @@ public void mongoIsUp() throws Exception {
76
76
assertEquals ("2.6.4" , health .getDetails ().get ("version" ));
77
77
78
78
Mockito .verify (commandResult ).getString ("version" );
79
- Mockito .verify (mongoTemplate ).executeCommand ("{ serverStatus : 1 }" );
79
+ Mockito .verify (mongoTemplate ).executeCommand ("{ buildInfo : 1 }" );
80
80
}
81
81
82
82
@ Test
83
83
public void mongoIsDown () throws Exception {
84
84
MongoTemplate mongoTemplate = Mockito .mock (MongoTemplate .class );
85
- Mockito .when (mongoTemplate .executeCommand ("{ serverStatus : 1 }" )).thenThrow (
85
+ Mockito .when (mongoTemplate .executeCommand ("{ buildInfo : 1 }" )).thenThrow (
86
86
new MongoException ("Connection failed" ));
87
87
MongoHealthIndicator healthIndicator = new MongoHealthIndicator (mongoTemplate );
88
88
@@ -91,6 +91,6 @@ public void mongoIsDown() throws Exception {
91
91
assertTrue (((String ) health .getDetails ().get ("error" ))
92
92
.contains ("Connection failed" ));
93
93
94
- Mockito .verify (mongoTemplate ).executeCommand ("{ serverStatus : 1 }" );
94
+ Mockito .verify (mongoTemplate ).executeCommand ("{ buildInfo : 1 }" );
95
95
}
96
96
}
0 commit comments