package blockchain.utility; import blockchain.user.UserContext; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; import org.junit.FixMethodOrder; import org.junit.Ignore; import org.junit.Test; import org.junit.runners.MethodSorters; //Test to Read and Write user from files @Ignore @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class UtilTest { private static Logger logger = Logger.getLogger(UtilTest.class); @Test public void TestAReadNullUser(){ BasicConfigurator.configure(); logger.info("----- START TEST READ NULL USER ----"); UserContext uc = Util.readUserContext("tata","abdel"); if(uc!=null){ logger.info("UserContext is : "+uc.toString()); }else{ logger.info("UserContext doesn't exist"); } } @Test public void TestBWriteUser(){ BasicConfigurator.configure(); logger.info("----- START TEST WRITE NULL USER ----"); UserContext user = new UserContext(); user.setName("abdel"); user.setAffiliation("toto"); user.setEnrollment(null); user.setMspId("test"); Util.writeUserContext(user); } @Test public void TestCReadCreatedUser(){ BasicConfigurator.configure(); logger.info("----- START TEST READ CREATED USER ----"); UserContext uc = Util.readUserContext("toto","abdel"); if(uc!=null){ logger.info("UserContext is : "+uc.toString()); }else{ logger.info("UserContext doesn't exist"); } } }