package org.ovirt.engine.core.compat;

import junit.framework.TestCase;

public class RegexTest extends TestCase {
    public void testSimpleMatches() {
        Regex regex = new Regex("[0-9]");
        assertTrue("A number should match", regex.IsMatch("1"));
        assertFalse("A letter should not match", regex.IsMatch("a"));
    }

    public void testIsMatch() {
        assertTrue("A number should match", Regex.IsMatch("1", "[0-9]"));
        assertFalse("A letter should not match", Regex.IsMatch("a", "[0-9]"));
    }

    public void testIgnoreCaseOff() {
        Regex regex = new Regex("[A-Z]");
        assertTrue("A cap should match", regex.IsMatch("K"));
        assertFalse("A lowercase should not match", regex.IsMatch("k"));
    }

    public void testIgnoreCaseOn() {
        Regex regex = new Regex("[A-Z]", RegexOptions.IgnoreCase);
        assertTrue("A cap should match", regex.IsMatch("K"));
        assertTrue("A lowercase should  match", regex.IsMatch("k"));
    }

    public void testGroups() {
        Match match = Regex.Match("ABC,123", "([A-Z]+),([0-9]+)");
        assertEquals("First Group", "ABC", match.Groups().get(0).getValue());
        assertEquals("Second Group", "123", match.Groups().get(1).getValue());
    }
}

@@ -43,32 +43,155 @@
 ort 
-junit.framework.TestCase
+static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport org.junit.Test
 ;%0A%0Ap
@@ -216,26 +216,20 @@
 est 
-extends TestCase %7B
+%7B%0A%0A    @Test
 %0A   
@@ -439,32 +439,42 @@
 h(%22a%22));%0A    %7D%0A%0A
+    @Test%0A
     public void 
@@ -641,32 +641,42 @@
 0-9%5D%22));%0A    %7D%0A%0A
+    @Test%0A
     public void 
@@ -873,32 +873,42 @@
 h(%22k%22));%0A    %7D%0A%0A
+    @Test%0A
     public void 
@@ -1129,24 +1129,34 @@
 %22));%0A    %7D%0A%0A
+    @Test%0A
     public v

use JUnit 4 syntax in RegexTest