Skip to content

Commit

Permalink
Some naming tidying up.
Browse files Browse the repository at this point in the history
  • Loading branch information
EranBoudjnah committed Aug 18, 2023
1 parent cac700e commit a276ea9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import com.mitteloupe.testit.model.FunctionMetadata
import com.mitteloupe.testit.model.StaticFunctionsMetadata
import com.mitteloupe.testit.model.TypedParameter

private val UNKNOWN_DATA_TYPE = DataType.Specific("Unknown", false)
private val UNIT_DATA_TYPE = DataType.Specific("Unit", false)
private val unknownDataType = DataType.Specific("Unknown", false)
private val unitDataType = DataType.Specific("Unit", false)

private const val NODE_NAME_SIMPLE_IDENTIFIER = "simpleIdentifier"
private const val NODE_NAME_IDENTIFIER = "Identifier"
Expand Down Expand Up @@ -174,7 +174,7 @@ class AntlrKotlinFileParser(

"receiverType" -> {
extensionReceiverType =
extractDataType(childNode)?.text?.dataType ?: UNKNOWN_DATA_TYPE
extractDataType(childNode)?.text?.dataType ?: unknownDataType
}

"functionValueParameters" -> {
Expand All @@ -186,13 +186,13 @@ class AntlrKotlinFileParser(
"type" -> {
returnType = extractDataType(childNode)
?.text?.appendNullableIfNeeded(childNode)?.dataType
?: UNKNOWN_DATA_TYPE
?: unknownDataType
}

"functionBody" -> {
if (returnType == null) {
extractTypeByAssignment(childNode)?.let {
returnType = UNKNOWN_DATA_TYPE
returnType = unknownDataType
}
}
}
Expand All @@ -213,7 +213,7 @@ class AntlrKotlinFileParser(
isAbstract,
functionParameters,
extensionReceiverType,
returnType ?: UNIT_DATA_TYPE
returnType ?: unitDataType
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private const val TEST_CLASS_NAME = "TestClass"
private const val CLASS_UNDER_TEST_VARIABLE_NAME = "cut"
private const val ACTUAL_VALUE_VARIABLE_NAME = "actualTest"
private const val DEFAULT_ASSERTION_STATEMENT = "defaultAssertion"
private val EXCEPTION_CAPTURE_METHOD = ExceptionCaptureMethod.NO_CAPTURE
private val exceptionCaptureMethod = ExceptionCaptureMethod.NO_CAPTURE
private const val PARAMETERIZED_RUNNER_ANNOTATION = "@Parameterized"
private const val MOCKING_RULE = "__@get:Rule\n__val mockitoRule: MethodRule = MockitoJUnit.rule()"

Expand Down Expand Up @@ -70,7 +70,7 @@ class TestStringBuilderTest {
CLASS_UNDER_TEST_VARIABLE_NAME,
ACTUAL_VALUE_VARIABLE_NAME,
DEFAULT_ASSERTION_STATEMENT,
EXCEPTION_CAPTURE_METHOD
exceptionCaptureMethod
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.given
import org.mockito.kotlin.mock

private const val mockitoRuleVariableName = "testMockitoRule"
private const val MOCKITO_RULE_VARIABLE_NAME = "testMockitoRule"

@RunWith(MockitoJUnitRunner::class)
class MockitoCodeGeneratorTest {
Expand All @@ -36,7 +36,7 @@ class MockitoCodeGeneratorTest {
given { formatting.getIndentation(1) }.willReturn("_")

classUnderTest =
MockitoCodeGenerator(mockableTypeQualifier, formatting, mockitoRuleVariableName)
MockitoCodeGenerator(mockableTypeQualifier, formatting, MOCKITO_RULE_VARIABLE_NAME)
}

@Test
Expand Down Expand Up @@ -307,7 +307,7 @@ class MockitoCodeGeneratorTest {
fun `When getting mockingRule then returns expected code`() {
// Given
val expectedValue = "_@get:Rule\n" +
"_val $mockitoRuleVariableName: MethodRule = MockitoJUnit.rule()"
"_val $MOCKITO_RULE_VARIABLE_NAME: MethodRule = MockitoJUnit.rule()"

// When
val actualValue = classUnderTest.mockingRule
Expand Down

0 comments on commit a276ea9

Please sign in to comment.