package net.fortytwo.smsn.brain.io.vcs;

import org.junit.Test;

import java.io.File;

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

public class VCSFormatTest {
    @Test
    public void atomFilesAccepted() throws Exception {
        assertTrue(VCSFormat.isAtomFile(new File("a1234567")));
        assertTrue(VCSFormat.isAtomFile(new File("a12345")));
        assertTrue(VCSFormat.isAtomFile(new File("au-lH78_")));
        File dir = new File("/tmp");
        assertTrue(VCSFormat.isAtomFile(new File(dir, "a1234567")));
    }

    @Test
    public void nonAtomFilesRejected() throws Exception {
        assertFalse(VCSFormat.isAtomFile(new File("a1234")));
        assertFalse(VCSFormat.isAtomFile(new File("1234567")));
        assertFalse(VCSFormat.isAtomFile(new File("12345678")));
        assertFalse(VCSFormat.isAtomFile(new File("a 1234567")));
        assertFalse(VCSFormat.isAtomFile(new File("b1234567")));
        assertFalse(VCSFormat.isAtomFile(new File("a1234567.txt")));
    }
}

@@ -312,24 +312,32 @@
 w File(%22
-a1234567
+UuYPT6ck7jBL6abZ
 %22)));%0A  
@@ -388,20 +388,31 @@
 le(%22
-a12345
+0KOr3InLzs3sgAEK
 %22)));%0A
+%0A
     
@@ -461,16 +461,13 @@
 le(%22
-au-lH78_
+UuYPT
 %22)))
@@ -560,24 +560,21 @@
 e(dir, %22
-a1234567
+UuYPT
 %22)));%0A  
@@ -693,25 +693,24 @@
 e(new File(%22
-a
 1234%22)));%0A  
@@ -754,24 +754,25 @@
 e(new File(%22
+?
 1234567%22)));
@@ -831,16 +831,18 @@
 12345678
+ 9
 %22)));%0A  
@@ -895,22 +895,89 @@
 e(%22a
- 
 1234567
+.txt
 %22)));%0A
+    %7D%0A%0A    @Test%0A    public void oldSchoolAtomFilesRejected() %7B%0A
     
@@ -1027,22 +1027,59 @@
 le(%22
-b1234567
+au-lH78_
 %22)));%0A
+        File dir = new File(%22/tmp%22);%0A
     
@@ -1120,37 +1120,39 @@
 le(new File(
+dir, 
 %22a1
+_
 234567
-.txt
 %22)));%0A    %7D%0A

Test tweak