Switch to Objects.requireNonNull
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / generator / impl / AbstractTypesTest.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.mdsal.binding.generator.impl;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.io.File;
13 import java.net.URISyntaxException;
14 import java.net.URL;
15 import java.util.HashSet;
16 import java.util.Set;
17 import org.junit.Before;
18
19 public abstract class AbstractTypesTest {
20
21     private final URL testSourcesDirUrl;
22     protected Set<File> testModels;
23
24     AbstractTypesTest(final URL testSourcesDirUrl) {
25         this.testSourcesDirUrl = testSourcesDirUrl;
26     }
27
28     @Before
29     public void loadTestResources() throws URISyntaxException {
30         File testSourcesDir = new File(testSourcesDirUrl.toURI());
31         File[] testFiles = requireNonNull(testSourcesDir.listFiles(), testSourcesDir + " does not denote a directory");
32         testModels = new HashSet<>();
33         for (File file : testFiles) {
34             if (file.isFile()) {
35                 testModels.add(file);
36             }
37         }
38     }
39
40 }