Skip to content

Commit

Permalink
add tests for SearchParameter(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
seelchen committed Jan 12, 2024
1 parent f56d313 commit e3df339
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2014-2024 Arpit Khurana <[email protected]>, Vishal Nehra <[email protected]>,
* Emmanuel Messulam<[email protected]>, Raymond Lai <airwave209gt at gmail.com> and Contributors.
*
* This file is part of Amaze File Manager.
*
* Amaze File Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.amaze.filemanager.asynchronous.asynctasks.searchfilesystem

import org.junit.Assert
import org.junit.Test
import java.util.EnumSet

class SearchParameterTest {
@Test
fun testAnd() {

Check warning on line 29 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParameterTest.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParameterTest.kt#L29

The function testAnd is missing documentation.
val expected = EnumSet.of(SearchParameter.ROOT, SearchParameter.REGEX_MATCHES)
val actual = SearchParameter.ROOT and SearchParameter.REGEX_MATCHES
Assert.assertEquals(expected, actual)
}

@Test
fun testPlus() {

Check warning on line 36 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParameterTest.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParameterTest.kt#L36

The function testPlus is missing documentation.
val expected = EnumSet.of(SearchParameter.ROOT, SearchParameter.REGEX_MATCHES)
val actual = SearchParameter.ROOT + SearchParameter.REGEX_MATCHES
Assert.assertEquals(expected, actual)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright (C) 2014-2024 Arpit Khurana <[email protected]>, Vishal Nehra <[email protected]>,
* Emmanuel Messulam<[email protected]>, Raymond Lai <airwave209gt at gmail.com> and Contributors.
*
* This file is part of Amaze File Manager.
*
* Amaze File Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.amaze.filemanager.asynchronous.asynctasks.searchfilesystem

import org.junit.Assert
import org.junit.Test
import java.util.EnumSet

class SearchParametersTest {

@Test
fun testAdd() {

Check warning on line 30 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L30

The function testAdd is missing documentation.
val expected = EnumSet.of(SearchParameter.SHOW_HIDDEN_FILES, SearchParameter.ROOT)
val actual = SearchParameter.SHOW_HIDDEN_FILES and SearchParameter.ROOT
Assert.assertEquals(expected, actual)
}

@Test
fun testPlus() {

Check warning on line 37 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L37

The function testPlus is missing documentation.
val expected = EnumSet.of(SearchParameter.REGEX, SearchParameter.ROOT)
val actual = EnumSet.of(SearchParameter.REGEX) + SearchParameter.ROOT
Assert.assertEquals(expected, actual)
}

@Test
fun testSearchParametersFromBooleanWithNone() {

Check warning on line 44 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L44

The function testSearchParametersFromBooleanWithNone is missing documentation.
val expected = EnumSet.noneOf(SearchParameter::class.java)
val actual = searchParametersFromBoolean()
Assert.assertEquals(expected, actual)
}

@Test
fun testSearchParametersFromBooleanWithOne() {

Check warning on line 51 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L51

The function testSearchParametersFromBooleanWithOne is missing documentation.
val expected = EnumSet.of(SearchParameter.ROOT)
val actual = searchParametersFromBoolean(isRoot = true)
Assert.assertEquals(expected, actual)
}

@Test
fun testSearchParametersFromBooleanWithTwo() {

Check warning on line 58 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L58

The function testSearchParametersFromBooleanWithTwo is missing documentation.
val expected = EnumSet.of(SearchParameter.ROOT, SearchParameter.SHOW_HIDDEN_FILES)
val actual = searchParametersFromBoolean(isRoot = true, showHiddenFiles = true)
Assert.assertEquals(expected, actual)
}

@Test
fun testSearchParametersFromBooleanWithThree() {

Check warning on line 65 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L65

The function testSearchParametersFromBooleanWithThree is missing documentation.
val expected = EnumSet.of(
SearchParameter.ROOT,
SearchParameter.REGEX,
SearchParameter.REGEX_MATCHES
)
val actual = searchParametersFromBoolean(
isRoot = true,
isRegexEnabled = true,
isRegexMatchesEnabled = true
)
Assert.assertEquals(expected, actual)
}

@Test
fun testSearchParametersFromBooleanWithFour() {

Check warning on line 80 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L80

The function testSearchParametersFromBooleanWithFour is missing documentation.
val expected = EnumSet.of(
SearchParameter.ROOT,
SearchParameter.REGEX,
SearchParameter.REGEX_MATCHES,
SearchParameter.SHOW_HIDDEN_FILES
)
val actual = searchParametersFromBoolean(
isRoot = true,
isRegexEnabled = true,
isRegexMatchesEnabled = true,
showHiddenFiles = true
)
Assert.assertEquals(expected, actual)
}
}

0 comments on commit e3df339

Please sign in to comment.