Search in sources :

Example 11 with Template

use of com.microsoft.azure.sdk.iot.device.Template in project azure-iot-sdk-java by Azure.

the class TemplateTest method testOpenCreatesNewSet.

// Tests_SRS_TEMPLATE_99_004: [The method shall create a new instance of the unionSet .]
@Test
public void testOpenCreatesNewSet(@Mocked final Set<String> mockedSet) {
    //arrange
    final String testString = "testString";
    /* Set any expectations on mocked object */
    new NonStrictExpectations() {

        {
        }
    };
    /* Use Deencapsulation or reflection to access objects that are not scoped for test */
    Template testObject = Deencapsulation.newInstance(Template.class, testString);
    //act
    /* Use Deencapsulation or reflection to access objects that are not scoped for test */
    Deencapsulation.invoke(testObject, "open");
    //assert
    /* Use Deencapsulation or reflection to access objects that are not scoped for test */
    final Set actualSet = Deencapsulation.getField(testObject, "unionSet");
    assertNotNull(actualSet);
    assertEquals(actualSet, mockedSet);
    /* Verify any call flow on mocked objects that is expected on act */
    new Verifications() {

        {
            new HashSet<>();
        }
    };
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Verifications(mockit.Verifications) NonStrictExpectations(mockit.NonStrictExpectations) Template(com.microsoft.azure.sdk.iot.device.Template) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Template (com.microsoft.azure.sdk.iot.device.Template)11 NonStrictExpectations (mockit.NonStrictExpectations)11 Test (org.junit.Test)11 Verifications (mockit.Verifications)8 HashSet (java.util.HashSet)6 Set (java.util.Set)5