ServerVersion { public static ServerVersion fromBoltProtocolVersion( BoltProtocolVersion protocolVersion ) { if ( BoltProtocolV4.VERSION.equals( protocolVersion ) ) { return ServerVersion.v4_0_0; } else if ( BoltProtocolV41.VERSION.equals( protocolVersion ) ) { return ServerVersion.v4_1_0; } else if ( BoltProtocolV42.VERSION.equals( protocolVersion ) ) { return ServerVersion.v4_2_0; } return ServerVersion.vInDev; } private  ServerVersion( String product, int major, int minor, int patch ); String product(); static ServerVersion version( Driver driver ); static ServerVersion version( String server ); @Override boolean equals( Object o ); @Override int hashCode(); boolean greaterThan(ServerVersion other); boolean greaterThanOrEqual(ServerVersion other); boolean lessThan(ServerVersion other); boolean lessThanOrEqual(ServerVersion other); @Override String toString(); static ServerVersion fromBoltProtocolVersion( BoltProtocolVersion protocolVersion ); static final String NEO4J_PRODUCT; static final ServerVersion v4_2_0; static final ServerVersion v4_1_0; static final ServerVersion v4_0_0; static final ServerVersion v3_5_0; static final ServerVersion v3_4_0; static final ServerVersion vInDev; }
@Test void shouldReturnCorrectServerVersionFromBoltProtocolVersion() { assertEquals( ServerVersion.v4_0_0, ServerVersion.fromBoltProtocolVersion( BoltProtocolV4.VERSION ) ); assertEquals( ServerVersion.v4_1_0, ServerVersion.fromBoltProtocolVersion( BoltProtocolV41.VERSION ) ); assertEquals( ServerVersion.v4_2_0, ServerVersion.fromBoltProtocolVersion( BoltProtocolV42.VERSION ) ); assertEquals( ServerVersion.vInDev, ServerVersion.fromBoltProtocolVersion( new BoltProtocolVersion( MAX_VALUE, MAX_VALUE ) ) ); }