/**
 * Copyright 2016 Palantir Technologies
 *
 * Licensed under the BSD-3 License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.palantir.atlasdb.keyvalue.cassandra;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

import org.junit.Test;

public class CassandraServerVersionTest {
    @Test public void
    version_19_37_0_supports_cas() {
        CassandraServerVersion version = new CassandraServerVersion("19.37.0");
        assertThat(version.supportsCheckAndSet(), is(true));
    }

    @Test public void
    version_19_36_0_does_not_support_cas() {
        CassandraServerVersion version = new CassandraServerVersion("19.36.0");
        assertThat(version.supportsCheckAndSet(), is(false));
    }

    @Test public void
    version_19_38_0_supports_cas() {
        CassandraServerVersion version = new CassandraServerVersion("19.38.0");
        assertThat(version.supportsCheckAndSet(), is(true));
    }

    @Test public void
    version_20_1_0_supports_cas() {
        CassandraServerVersion version = new CassandraServerVersion("20.1.0");
        assertThat(version.supportsCheckAndSet(), is(true));
    }

    @Test public void
    version_18_40_0_does_not_support_cas() {
        CassandraServerVersion version = new CassandraServerVersion("20.1.0");
        assertThat(version.supportsCheckAndSet(), is(true));
    }

    @Test public void
    version_20_40_1_does_support_cas() {
        CassandraServerVersion version = new CassandraServerVersion("20.40.1");
        assertThat(version.supportsCheckAndSet(), is(true));
    }

    @Test(expected=UnsupportedOperationException.class) public void
    invalid_version_strings_throw_an_error() {
        new CassandraServerVersion("20_4.1");
    }

}

@@ -833,20 +833,28 @@
 19_3
-7
+6
 _0_
+does_not_
 support
-s
 _cas
@@ -935,9 +935,9 @@
 19.3
-7
+6
 .0%22)
@@ -983,35 +983,36 @@
 eckAndSet(), is(
-tru
+fals
 e));%0A    %7D%0A%0A    
@@ -1045,36 +1045,28 @@
 ion_19_3
-6
+7
 _0_
-does_not_
 support
+s
 _cas() %7B
@@ -1131,33 +1131,33 @@
 verVersion(%2219.3
-6
+7
 .0%22);%0A        as
@@ -1191,36 +1191,35 @@
 eckAndSet(), is(
-fals
+tru
 e));%0A    %7D%0A%0A    
@@ -1754,36 +1754,37 @@
 aServerVersion(%22
-20.1
+18.40
 .0%22);%0A        as
@@ -1818,35 +1818,36 @@
 eckAndSet(), is(
-tru
+fals
 e));%0A    %7D%0A%0A    
@@ -1888,20 +1888,16 @@
 0_1_
-does_
 support
+s
 _cas

Clean up tests