2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang2sources.plugin;
10 import java.io.InputStream;
11 import java.util.zip.ZipEntry;
12 import java.util.zip.ZipFile;
13 import org.junit.Assert;
14 import org.junit.Test;
15 import org.junit.runner.RunWith;
16 import org.mockito.Mockito;
17 import org.mockito.runners.MockitoJUnitRunner;
19 @RunWith(MockitoJUnitRunner.class)
20 public class YangSourceInZipFileTest {
23 public void yangSourceInZipFileTest() throws Exception {
24 final ZipFile file = Mockito.mock(ZipFile.class);
25 final ZipEntry entry = Mockito.mock(ZipEntry.class);
26 Mockito.when(entry.getSize()).thenReturn(519L);
27 final InputStream inputStream = Mockito.mock(InputStream.class);
28 Mockito.when(file.getInputStream(entry)).thenReturn(inputStream);
29 final YangSourceInZipFile yangSource = new YangSourceInZipFile(file, entry);
30 Assert.assertEquals(519, yangSource.size());
31 Assert.assertNotNull(yangSource.openStream());