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);
}
Aggregations