Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ApiVersionTest.java « model « shared « notes « owncloud « niedermann « it « java « test « src « app - github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5b3b6f5be26343272e7472fa389cf9ec79966fe3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package it.niedermann.owncloud.notes.shared.model;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class ApiVersionTest {

    @Test
    public void shouldOnlyCompareMajorApiVersions() {
        final var apiVersion = new ApiVersion("1.0", 1, 0);

        assertEquals(1, apiVersion.compareTo(ApiVersion.API_VERSION_0_2));
        assertEquals(0, apiVersion.compareTo(ApiVersion.API_VERSION_1_0));
        assertEquals(0, apiVersion.compareTo(ApiVersion.API_VERSION_1_2));
    }

    @Test
    public void shouldOnlyEqualMajorApiVersions() {
        final var apiVersion = new ApiVersion("1.0", 1, 0);

        assertNotEquals(apiVersion, ApiVersion.API_VERSION_0_2);
        assertEquals(apiVersion, ApiVersion.API_VERSION_1_0);
        assertEquals(apiVersion, ApiVersion.API_VERSION_1_2);
    }

    @Test
    public void shouldSupportFileSuffixChangesWithApi1_3andAbove() {
        assertFalse(ApiVersion.API_VERSION_0_2.supportsFileSuffixChange());
        assertFalse(ApiVersion.API_VERSION_1_0.supportsFileSuffixChange());
        assertFalse(ApiVersion.API_VERSION_1_2.supportsFileSuffixChange());
        assertTrue(ApiVersion.API_VERSION_1_3.supportsFileSuffixChange());
    }

    @Test
    public void shouldSupportNotesPathChangesWithApi1_2andAbove() {
        assertFalse(ApiVersion.API_VERSION_0_2.supportsNotesPathChange());
        assertFalse(ApiVersion.API_VERSION_1_0.supportsNotesPathChange());
        assertTrue(ApiVersion.API_VERSION_1_2.supportsNotesPathChange());
        assertTrue(ApiVersion.API_VERSION_1_3.supportsNotesPathChange());
    }
}