Enforce checkstyle in maven-plugin
[yangtools.git] / yang / yang-maven-plugin / src / test / java / org / opendaylight / yangtools / yang2sources / plugin / YangSourceInZipFileTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang2sources.plugin;
9
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;
18
19 @RunWith(MockitoJUnitRunner.class)
20 public class YangSourceInZipFileTest {
21
22     @Test
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());
32     }
33
34 }