Skip to content

Commit

Permalink
chore: JUnit5 test classes and methods should have default package vi…
Browse files Browse the repository at this point in the history
…sibility (#746)
  • Loading branch information
steve-todorov committed Jul 29, 2023
1 parent 2be9515 commit 3b919b9
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: '1'
fetch-depth: '0' # 1 because of sonar.

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import static org.junit.jupiter.api.Assertions.assertEquals;


public class AttributesUtilsTest
class AttributesUtilsTest
{

@Test
public void filterAll()
void filterAll()
{

final String key = "key";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;

public class CacheTest
class CacheTest
{


@Test
public void cacheIsInclusive()
void cacheIsInclusive()
{
Cache cache = spy(new Cache());

Expand All @@ -29,7 +28,7 @@ public void cacheIsInclusive()
}

@Test
public void outOfTime()
void outOfTime()
{
Cache cache = spy(new Cache());

Expand All @@ -44,7 +43,7 @@ public void outOfTime()
}

@Test
public void infinite()
void infinite()
{
Cache cache = spy(new Cache());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class S3FileAttributesTest
class S3FileAttributesTest
{


@Test
public void toStringPrintsBasicInfo()
void toStringPrintsBasicInfo()
{
final String key = "a key";
final FileTime fileTime = FileTime.from(100, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void getParent()
}

@Test
public void normalize()
void normalize()
{
assertEquals(forPath("/bucket"), forPath("/bucket").normalize());
assertEquals(forPath("/bucket/"), forPath("/bucket/").normalize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class FileStoreTest
class FileStoreTest
{

FileSystem fs;
Expand Down Expand Up @@ -40,7 +40,7 @@ public void close()
}

@Test
public void getFileStore()
void getFileStore()
{
System.out.println("Default:");
System.out.println("-------");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

public class PathSpecTest
class PathSpecTest
{

FileSystem fs;
Expand Down Expand Up @@ -44,7 +44,7 @@ public void close()
// first and more

@Test
public void firstAndMore()
void firstAndMore()
{
assertEquals(fs.getPath("/dir", "dir", "file"), fs.getPath("/dir", "dir/file"));
assertEquals(fs.getPath("/dir/dir/file"), fs.getPath("/dir", "dir/file"));
Expand All @@ -53,152 +53,152 @@ public void firstAndMore()
// absolute relative

@Test
public void relative()
void relative()
{
assertFalse(get("file").isAbsolute());
}

@Test
public void absolute()
void absolute()
{
assertTrue(get("/file/file2").isAbsolute());
}

// test starts with

@Test
public void startsWith()
void startsWith()
{
assertTrue(get("/file/file1").startsWith(get("/file")));
}

@Test
public void startsWithBlank()
void startsWithBlank()
{
assertFalse(get("/file").startsWith(get("")));
}

@Test
public void startsWithBlankRelative()
void startsWithBlankRelative()
{
assertFalse(get("file1").startsWith(get("")));
}

@Test
public void startsWithBlankBlank()
void startsWithBlankBlank()
{
assertTrue(get("").startsWith(get("")));
}

@Test
public void startsWithRelativeVsAbsolute()
void startsWithRelativeVsAbsolute()
{
assertFalse(get("/file/file1").startsWith(get("file")));
}

@Test
public void startsWithFalse()
void startsWithFalse()
{
assertFalse(get("/file/file1").startsWith(get("/file/file1/file2")));
assertTrue(get("/file/file1/file2").startsWith(get("/file/file1")));
}

@Test
public void startsWithNotNormalize()
void startsWithNotNormalize()
{
assertFalse(get("/file/file1/file2").startsWith(get("/file/file1/../")));
}

@Test
public void startsWithNormalize()
void startsWithNormalize()
{
assertTrue(get("/file/file1/file2").startsWith(get("/file/file1/../").normalize()));
}

@Test
public void startsWithRelative()
void startsWithRelative()
{
assertTrue(get("file/file1").startsWith(get("file")));
}

@Test
public void startsWithString()
void startsWithString()
{
assertTrue(get("/file/file1").startsWith("/file"));
}

// ends with

@Test
public void endsWithAbsoluteRelative()
void endsWithAbsoluteRelative()
{
assertTrue(get("/file/file1").endsWith(get("file1")));
}

@Test
public void endsWithAbsoluteAbsolute()
void endsWithAbsoluteAbsolute()
{
assertTrue(get("/file/file1").endsWith(get("/file/file1")));
}

@Test
public void endsWithRelativeRelative()
void endsWithRelativeRelative()
{
assertTrue(get("file/file1").endsWith(get("file1")));
}

@Test
public void endsWithRelativeAbsolute()
void endsWithRelativeAbsolute()
{
assertFalse(get("file/file1").endsWith(get("/file")));
}

@Test
public void endsWithDifferentFileSystem()
void endsWithDifferentFileSystem()
{
assertFalse(get("/file/file1").endsWith(Paths.get("/file/file1")));
}

@Test
public void endsWithBlankRelativeAbsolute()
void endsWithBlankRelativeAbsolute()
{
assertFalse(get("").endsWith(get("/bucket")));
}

@Test
public void endsWithBlankBlank()
void endsWithBlankBlank()
{
assertTrue(get("").endsWith(get("")));
}

@Test
public void endsWithRelativeBlankAbsolute()
void endsWithRelativeBlankAbsolute()
{
assertFalse(get("/bucket/file1").endsWith(get("")));
}

@Test
public void endsWithRelativeBlankRelative()
void endsWithRelativeBlankRelative()
{
assertFalse(get("file1").endsWith(get("")));
}

@Test
public void getParentNull()
void getParentNull()
{
assertNull(get("/").getParent());
}

@Test
public void getParentWindowsNull()
void getParentWindowsNull()
{
assertNull(fsWindows.getPath("C://").getParent());
}

// file name

@Test
public void getFileName()
void getFileName()
throws IOException
{
try (FileSystem windows = MemoryFileSystemBuilder.newWindows().build("widows"))
Expand All @@ -212,7 +212,7 @@ public void getFileName()
}

@Test
public void getFileNameRootIsNull()
void getFileNameRootIsNull()
{
Path fileNameRoot = fs.getRootDirectories().iterator().next().getFileName();

Expand All @@ -222,13 +222,13 @@ public void getFileNameRootIsNull()
// root

@Test
public void getRootReturnBucket()
void getRootReturnBucket()
{
assertEquals(get("/"), get("/dir/dir/file").getRoot());
}

@Test
public void fileWithSameNameAsDir()
void fileWithSameNameAsDir()
throws IOException
{
// We're expecting an exception here to be thrown
Expand All @@ -241,7 +241,7 @@ public void fileWithSameNameAsDir()
}

@Test
public void dirWithSameNameAsFile()
void dirWithSameNameAsFile()
{
// We're expecting an exception here to be thrown
Exception exception = assertThrows(FileAlreadyExistsException.class, () -> {
Expand All @@ -253,21 +253,21 @@ public void dirWithSameNameAsFile()
}

@Test
public void createDirWithoutEndSlash()
void createDirWithoutEndSlash()
throws IOException
{
Path dir = Files.createDirectory(fs.getPath("/tmp"));
Files.isDirectory(dir);
}

@Test
public void getRootRelativeReturnNull()
void getRootRelativeReturnNull()
{
assertNull(get("dir/file").getRoot());
}

@Test
public void getRoot()
void getRoot()
{
System.out.println("Default:");
System.out.println("-------");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class ProviderSpecTest
class ProviderSpecTest
{

FileSystem fs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,24 @@
import java.util.Map;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class SpecTest
class SpecTest
{


@Test
public void parentOfRelativeSinglePathIsNull()
void parentOfRelativeSinglePathIsNull()
{
Path path = FileSystems.getDefault().getPath("relative");

assertNull(path.getParent());
}

@Test
public void readAttributes()
void readAttributes()
throws IOException
{
Path path = Files.createTempFile("asdas", "sdasda");
Expand All @@ -37,7 +38,7 @@ public void readAttributes()
}

@Test
public void installedFileSystemsLoadFromMetaInf()
void installedFileSystemsLoadFromMetaInf()
{
List<FileSystemProvider> providers = FileSystemProvider.installedProviders();
boolean installed = false;
Expand Down
Loading

0 comments on commit 3b919b9

Please sign in to comment.