Search in sources :

Example 1 with MockUser

use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser in project fabric-sdk-java by hyperledger.

the class ClientTest method testBadEnrollmentNull.

@Test(expected = InvalidArgumentException.class)
public void testBadEnrollmentNull() throws Exception {
    HFClient client = HFClient.createNewInstance();
    client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
    MockUser mockUser = TestUtils.getMockUser(USER_NAME, USER_MSP_ID);
    mockUser.setEnrollment(null);
    client.setUserContext(mockUser);
}
Also used : MockUser(org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser) Test(org.junit.Test)

Example 2 with MockUser

use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser in project fabric-sdk-java by hyperledger.

the class ClientTest method testBadUserMSPIDEmpty.

@Test(expected = InvalidArgumentException.class)
public void testBadUserMSPIDEmpty() throws Exception {
    HFClient client = HFClient.createNewInstance();
    client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
    MockUser mockUser = TestUtils.getMockUser(USER_NAME, "");
    client.setUserContext(mockUser);
}
Also used : MockUser(org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser) Test(org.junit.Test)

Example 3 with MockUser

use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser in project fabric-sdk-java by hyperledger.

the class ClientTest method testBadUserNameEmpty.

@Test(expected = InvalidArgumentException.class)
public void testBadUserNameEmpty() throws Exception {
    HFClient client = HFClient.createNewInstance();
    client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
    MockUser mockUser = TestUtils.getMockUser("", USER_MSP_ID);
    client.setUserContext(mockUser);
}
Also used : MockUser(org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser) Test(org.junit.Test)

Example 4 with MockUser

use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser in project fabric-sdk-java by hyperledger.

the class ClientTest method testBadEnrollmentBadKey.

@Test(expected = InvalidArgumentException.class)
public void testBadEnrollmentBadKey() throws Exception {
    HFClient client = HFClient.createNewInstance();
    client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
    MockUser mockUser = TestUtils.getMockUser(USER_NAME, USER_MSP_ID);
    MockEnrollment mockEnrollment = TestUtils.getMockEnrollment(null, "mockCert");
    mockUser.setEnrollment(mockEnrollment);
    client.setUserContext(mockUser);
}
Also used : MockEnrollment(org.hyperledger.fabric.sdk.testutils.TestUtils.MockEnrollment) MockUser(org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser) Test(org.junit.Test)

Example 5 with MockUser

use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser in project fabric-sdk-java by hyperledger.

the class ClientTest method testBadUserNameNull.

@Test(expected = InvalidArgumentException.class)
public void testBadUserNameNull() throws Exception {
    HFClient client = HFClient.createNewInstance();
    client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
    MockUser mockUser = TestUtils.getMockUser(null, USER_MSP_ID);
    client.setUserContext(mockUser);
}
Also used : MockUser(org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser) Test(org.junit.Test)

Aggregations

MockUser (org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser)9 Test (org.junit.Test)8 MockEnrollment (org.hyperledger.fabric.sdk.testutils.TestUtils.MockEnrollment)3 PrivateKey (java.security.PrivateKey)1 NetworkConfig (org.hyperledger.fabric.sdk.NetworkConfig)1 Ignore (org.junit.Ignore)1