| 
 | 1 | +package org.neo4j.driver.internal.util;  | 
 | 2 | +/*  | 
 | 3 | + * Copyright (c) 2002-2017 "Neo Technology,"  | 
 | 4 | + * Network Engine for Objects in Lund AB [http://neotechnology.com]  | 
 | 5 | + *  | 
 | 6 | + * This file is part of Neo4j.  | 
 | 7 | + *  | 
 | 8 | + * Licensed under the Apache License, Version 2.0 (the "License");  | 
 | 9 | + * you may not use this file except in compliance with the License.  | 
 | 10 | + * You may obtain a copy of the License at  | 
 | 11 | + *  | 
 | 12 | + *     http://www.apache.org/licenses/LICENSE-2.0  | 
 | 13 | + *  | 
 | 14 | + * Unless required by applicable law or agreed to in writing, software  | 
 | 15 | + * distributed under the License is distributed on an "AS IS" BASIS,  | 
 | 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
 | 17 | + * See the License for the specific language governing permissions and  | 
 | 18 | + * limitations under the License.  | 
 | 19 | + */  | 
 | 20 | +import org.junit.Test;  | 
 | 21 | + | 
 | 22 | +import static org.hamcrest.MatcherAssert.assertThat;  | 
 | 23 | +import static org.hamcrest.Matchers.is;  | 
 | 24 | +import static org.junit.Assert.fail;  | 
 | 25 | + | 
 | 26 | +public class ServerVersionTest  | 
 | 27 | +{  | 
 | 28 | +    @Test  | 
 | 29 | +    public void version() throws Exception  | 
 | 30 | +    {  | 
 | 31 | +        String nullVersion = null;  | 
 | 32 | +        assertThat( ServerVersion.version( nullVersion ), is( ServerVersion.v3_0_0 ) );  | 
 | 33 | +        assertThat( ServerVersion.version( "Neo4j/dev" ), is( ServerVersion.vInDev ) );  | 
 | 34 | +        assertThat( ServerVersion.version( "Neo4j/3.2.0" ), is( ServerVersion.v3_2_0 ) );  | 
 | 35 | +    }  | 
 | 36 | + | 
 | 37 | +    @Test(expected = IllegalArgumentException.class)  | 
 | 38 | +    public void versionShouldThrowExceptionIfServerVersionCantBeParsed() throws Exception  | 
 | 39 | +    {  | 
 | 40 | +        ServerVersion.version( "" );  | 
 | 41 | +        fail( "Should have failed to parse version" );  | 
 | 42 | +    }  | 
 | 43 | + | 
 | 44 | +}  | 
0 commit comments