blob: 08fdd6d12d0386d5415e8fac292f86ee653f381d [file] [log] [blame]
/*
* Copyright (C) 2020 The Android Open Source Project
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.io.File;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
public class AssetsFinderTest {
File assetsDir;
File tuningforkDir;
@Before
public void getDirObjects() {
File root = new File(System.getProperty("user.dir"));
String path = root.getAbsolutePath() + ("/src/resources/assets");
assetsDir = new File(path);
tuningforkDir = new File(path + "/tuningfork");
}
@Test
public void noDirectoryFound() {
if (assetsDir.exists()) {
assetsDir.delete();
}
if (tuningforkDir.exists()) {
tuningforkDir.delete();
}
assert (!AssetsFinder.findAssets().isPresent());
}
@Test
public void directoryFound() {
if (!tuningforkDir.exists()) {
tuningforkDir.mkdirs();
}
assert (AssetsFinder.findAssets().isPresent());
}
}