package seedu.ezdo.storage;

import java.io.File;

import javax.xml.bind.JAXBException;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import seedu.ezdo.commons.util.XmlUtil;
//@@author A0139248X
@RunWith(PowerMockRunner.class)
@PrepareForTest({XmlFileStorage.class, XmlUtil.class})
public class XmlFileStorageTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void test() throws Exception {
        thrown.expect(AssertionError.class);
        PowerMockito.mockStatic(XmlUtil.class);
        File file = new File("omg");
        XmlSerializableEzDo ezDo = new XmlSerializableEzDo();
        PowerMockito.doThrow(new JAXBException("exception")).when(XmlUtil.class, "saveDataToFile", file, ezDo);
        XmlFileStorage.saveDataToFile(file, ezDo);
    }

}

@@ -42,16 +42,54 @@
 io.File;
+%0Aimport java.io.FileNotFoundException;
 %0A%0Aimport
@@ -245,53 +245,27 @@
 th;%0A
+%0A
 import 
-org.powermock.api.mockito.Power
+mockit.
 Mock
-ito
 ;%0Aim
@@ -273,120 +273,64 @@
 ort 
-org.powermock.core.classloader.annotations.PrepareForTest;%0Aimport org.powermock.modules.junit4.PowerMockRunner;%0A
+mockit.MockUp;%0Aimport mockit.integration.junit4.JMockit;
 %0Aimp
@@ -366,16 +366,17 @@
 mlUtil;%0A
+%0A
 //@@auth
@@ -401,84 +401,21 @@
 ith(
-PowerMockRunner.class)%0A@PrepareForTest(%7BXmlFileStorage.class, XmlUtil.class%7D
+JMockit.class
 )%0Apu
@@ -551,12 +551,56 @@
 oid 
-test
+saveDataToFile_JAXBException_throwAssertionError
 () t
@@ -666,56 +666,8 @@
 s);%0A
-        PowerMockito.mockStatic(XmlUtil.class);%0A
     
@@ -773,110 +773,248 @@
     
-PowerMockito.doThrow(new JAXBException(%22exception%22)).when(XmlUtil.class, %22saveDataToFile%22, file, ezDo)
+new MockUp%3CXmlUtil%3E()%0A        %7B%0A            @Mock%0A            %3CT%3E void saveDataToFile(File file, T data) throws FileNotFoundException, JAXBException%0A            %7B%0A                throw new JAXBException(%22exception%22);%0A            %7D%0A        %7D
 ;%0A  
@@ -1068,11 +1068,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Switch to JMockit