Github user GabrielBrascher commented on a diff in the pull request:
    --- Diff: 
    @@ -0,0 +1,167 @@
    +// Licensed to the Apache Software Foundation (ASF) under one
    +// or more contributor license agreements.  See the NOTICE file
    +// distributed with this work for additional information
    +// regarding copyright ownership.  The ASF licenses this file
    +// to you under the Apache License, Version 2.0 (the
    +// "License"); you may not use this file except in compliance
    +// with the License.  You may obtain a copy of the License at
    +// Unless required by applicable law or agreed to in writing,
    +// software distributed under the License is distributed on an
    +// KIND, either express or implied.  See the License for the
    +// specific language governing permissions and limitations
    +// under the License.
    +import static org.mockito.Matchers.any;
    +import static org.mockito.Matchers.eq;
    +import static org.mockito.Mockito.doReturn;
    +import static org.mockito.Mockito.mock;
    +import static org.mockito.Mockito.when;
    +import java.util.ArrayList;
    +import java.util.List;
    +import org.junit.Assert;
    +import org.junit.Test;
    +import org.junit.runner.RunWith;
    +import org.mockito.InjectMocks;
    +import org.mockito.Mock;
    +import org.mockito.Spy;
    +import org.powermock.api.mockito.PowerMockito;
    +import org.powermock.core.classloader.annotations.PrepareForTest;
    +import org.powermock.modules.junit4.PowerMockRunner;
    +public class DefaultEndPointSelectorTest {
    +    @Mock
    +    HostDao _hostDao;
    +    @Mock
    +    SecondaryStorageVmDao _ssvmDao;
    +    @InjectMocks
    +    @Spy
    +    DefaultEndPointSelector selector = new DefaultEndPointSelector();
    +    //Special mocked endpoints that the tests can use to identify what was 
returned from the method.
    +    private EndPoint selectMethodEndpoint = mock(EndPoint.class);
    +    private DummyEndpoint dummyEndpoint = mock(DummyEndpoint.class);
    +    /**
    +     * The single common method that sets up the mocks to cover all 
possible scenarios we want to
    +     * test. The VM type and volume state are passed in, while a potential 
list of existing SSVMs
    +     * are also passed in. As its final action, the method calls {@link 
DefaultEndPointSelector#select(DataObject, StorageAction)}
    +     * in order to test the method's operation and returns the endpoint 
    +     *
    +     * @param vmType - State of the VM attached to the volume
    +     * @param volumeState - State of the volume
    +     * @param ssvmVOs - A list of SSVMs to return from the DAO
    +     * @return The selected endpoint.
    +     */
    +    public EndPoint mockEndpointSelection(Type vmType, State volumeState, 
SecondaryStorageVmVO ... ssvmVOs) {
    --- End diff --
    This method could be private. Did I missed something?

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

Reply via email to