Search in sources :

Example 1 with RegistryInner

use of com.microsoft.azure.management.containerregistry.implementation.RegistryInner in project azure-tools-for-java by Microsoft.

the class ContainerRegistryMvpModelTest method testSetAdminUserEnabled.

@Test
public void testSetAdminUserEnabled() throws Exception {
    Registry.Update update = mock(Registry.Update.class);
    Registry.Update with = mock(Registry.Update.class);
    Registry.Update without = mock(Registry.Update.class);
    RegistryInner innerMock = mock(RegistryInner.class);
    when(registryMock1.update()).thenReturn(update);
    when(registryMock1.inner()).thenReturn(innerMock);
    when(update.withRegistryNameAsAdminUser()).thenReturn(with);
    when(update.withoutRegistryNameAsAdminUser()).thenReturn(without);
    Registry registry;
    registry = containerRegistryMvpModel.setAdminUserEnabled(MOCK_SUBSCRIPTION_ID, MOCK_REGISTRY_ID, true);
    verify(with, times(1)).apply();
    assertEquals(registryMock1, registry);
    registry = containerRegistryMvpModel.setAdminUserEnabled(MOCK_SUBSCRIPTION_ID, MOCK_REGISTRY_ID, false);
    verify(without, times(1)).apply();
    assertEquals(registryMock1, registry);
    registry = containerRegistryMvpModel.setAdminUserEnabled(MOCK_SUBSCRIPTION_ID_WITHOUT_REGISTRIES, MOCK_REGISTRY_ID, true);
    assertEquals(null, registry);
}
Also used : RegistryInner(com.microsoft.azure.management.containerregistry.implementation.RegistryInner) Registry(com.microsoft.azure.management.containerregistry.Registry) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Registry (com.microsoft.azure.management.containerregistry.Registry)1 RegistryInner (com.microsoft.azure.management.containerregistry.implementation.RegistryInner)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1