Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2011 UrsaJ Ltd ( Licensed 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 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import static com.ursaj.hfs.HfsTestUtils.RND;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;

 public class HfsDbFileServiceAdapterTest {

Test method wrapping.

java.lang.Exception In case of any exception.
     public void testMethodWrapping() throws Exception {
         DataSource dataSource = mock(DataSource.class);
         Connection connection = mock(Connection.class);
         @SuppressWarnings("unchecked"HfsDbFileServiceAdapter<Integerdelegate = mock(HfsDbFileServiceAdapter.class);
         HfsDbFileServiceAdapter<Integerservice = new Delegate<>(delegate);
         final Set<UUIDfileIds = new HashSet<>(Arrays.asList(UUID.randomUUID(), UUID.randomUUID()));
         final List<Integerfiles = Arrays.asList(1, 2, 3, .nextInt());
         final UUID fileId = UUID.randomUUID();
         final Consumer<UUIDIOExceptionconsumer = new HfsConsumer<>(new ArrayList<UUID>());

Delegate-based implementation of DB file service adapter.
     private static final class Delegate<T> extends HfsDbFileServiceAdapter<T> {
Delegate to perform all actual operations.
         private final HfsDbFileServiceAdapter<T> delegate;

Constructs delegate-based implementation of DB file service adapter.

delegate Delegate to perform actual operations.
         private Delegate(HfsDbFileServiceAdapter<T> delegate) {
             this. = delegate;
         protected Map<UUID, T> getFiles(Connection connectionSet<UUIDfileIdsthrows SQLExceptionIOException {
             return .getFiles(connectionfileIds);
         protected void storeFiles(Connection connectionCollection<T> filesthrows SQLExceptionIOException {
        protected boolean collectAliveFiles(Connection connectionUUID fromIdConsumer<UUIDIOExceptionconsumer)
            throws SQLExceptionIOException {
            return .collectAliveFiles(connectionfromIdconsumer);
New to GrepCode? Check out our FAQ X