import static org.junit.Assert.*;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import com.intel.vmf.Log;
import com.intel.vmf.Vmf;


public class VmfLogTest 
{
    @BeforeClass
    public static void init()
    {
        Vmf.initialize();
    }
    
    @AfterClass
    public static void terminate()
    {
        Vmf.terminate();
    }
    
    @Test
    public void testLog () throws IOException
    {
        File newFile = new File("myLogFile.txt");
        if (newFile.exists())
            newFile.delete();
        
        assertTrue(newFile.createNewFile()); 
        
        Log.setLogToFile("myLogFile.txt");
        BufferedReader in = new BufferedReader(new FileReader("myLogFile.txt"));
        String str = in.readLine();
        assertTrue (str == null);
        
        Log.log(Log.LOG_INFO, "Hello World!", "VmfLogTest::testLog", "VmfLogTest.java", 44);
        Log.log(Log.LOG_WARNING, "Hello World!", "VmfLogTest::testLog", "VmfLogTest.java", 45);
        Log.log(6, "Hello World!", "VmfLogTest::testLog", "VmfLogTest.java", 46);
        
        str = in.readLine();
        assertFalse (str.isEmpty());
        str.equals("INFO: Hello World! in VmfLogTest::testLog VmfLogTest.java:30");
        in.close();
        newFile.delete();
        
        Log.setLogToConsole ();
        
        Log.setVerbosityLevel(Log.LOG_INFO);
        assertEquals(Log.LOG_INFO, Log.getVerbosityLevel());
        
        Log.setVerbosityLevel(Log.LOG_WARNING);
        assertEquals(Log.LOG_WARNING, Log.getVerbosityLevel());
        
        Log.setVerbosityLevel(Log.LOG_ERROR);
        assertEquals(Log.LOG_ERROR, Log.getVerbosityLevel());
        
        Log.setVerbosityLevel(Log.LOG_NO_MESSAGE);
        assertEquals(Log.LOG_NO_MESSAGE, Log.getVerbosityLevel());
    }
}
@@ -158,21 +158,70 @@
 it.After
-Class
+;%0Aimport org.junit.AfterClass;%0Aimport org.junit.Before
 ;%0Aimport
@@ -540,13 +540,49 @@
     
-@Test
+protected File newFile; %0A    %0A    @Before
 %0A   
@@ -594,23 +594,21 @@
 ic void 
-testLog
+setUp
  () thro
@@ -636,20 +636,60 @@
         
-File
+Log.setVerbosityLevel(Log.LOG_INFO);%0A       
  newFile
@@ -710,32 +710,41 @@
 yLogFile.txt%22);%0A
+        %0A
         if (newF
@@ -783,37 +783,217 @@
 e.delete();%0A    
+%7D%0A
     %0A
+    @After%0A    public void tearDown ()%0A    %7B%0A        if (newFile.exists())%0A            newFile.delete();%0A    %7D%0A    %0A    @Test%0A    public void testLog () throws IOException%0A    %7B%0A
         assertTr
@@ -1326,10 +1326,10 @@
 a%22, 
-44
+61
 );%0A 
@@ -1422,10 +1422,10 @@
 a%22, 
-45
+62
 );%0A 
@@ -1439,17 +1439,29 @@
 Log.log(
-6
+Log.LOG_ERROR
 , %22Hello
@@ -1516,10 +1516,92 @@
 a%22, 
-4
 6
+3);%0A        Log.log(4, %22Hello World!%22, %22VmfLogTest::testLog%22, %22VmfLogTest.java%22, 64
 );%0A 
@@ -1629,32 +1629,67 @@
  in.readLine();%0A
+        assertFalse (str == null);%0A
         assertFa
@@ -1717,16 +1717,27 @@
         
+assertTrue(
 str.equa
@@ -1802,11 +1802,12 @@
 ava:
-30%22
+44%22)
 );%0A 
@@ -1829,34 +1829,8 @@
 ();%0A
-        newFile.delete();%0A
     

fix java test issue