Skip to content

Commit 1fbb6b8

Browse files
author
David Hasani
committed
fix test
1 parent 4922a84 commit 1fbb6b8

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/CodeModernizerArtifact.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ open class CodeModernizerArtifact(
105105
val metricsFile =
106106
tempDir.resolve(manifest.metricsRoot).listFiles()
107107
?.firstOrNull { it.name.endsWith(METRICS_FILE_NAME) }
108+
?: throw RuntimeException("Could not find metrics.json")
108109
return MAPPER.readValue(metricsFile, CodeModernizerMetrics::class.java)
109110
} catch (exception: JsonProcessingException) {
110-
throw RuntimeException("Unable to deserialize the metrics.json file")
111+
throw RuntimeException("Unable to deserialize the metrics.json")
111112
}
112113
}
113114

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/CodeModernizerMetrics.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ package software.aws.toolkits.jetbrains.services.codemodernizer.model
66
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
77

88
@JsonIgnoreProperties(ignoreUnknown = true)
9-
data class CodeModernizerMetrics(val linesOfCodeChanged: Int?, val charactersOfCodeChanged: Int?, var linesOfCodeSubmitted: Int?, var programmingLanguage: String?)
9+
data class CodeModernizerMetrics(
10+
val linesOfCodeChanged: Int?,
11+
val charactersOfCodeChanged: Int?,
12+
var linesOfCodeSubmitted: Int?,
13+
var programmingLanguage: String?,
14+
)
Binary file not shown.

plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class CodeWhispererCodeModernizerTest : CodeWhispererCodeModernizerTestBase() {
155155
fun `CodeModernizerArtifact can process a valid zip file`() {
156156
val artifact = CodeModernizerArtifact.create(exampleZipPath.toAbsolutePath().toString())
157157
assertEquals(validManifest, artifact.manifest)
158-
assertEquals(validTransformationSummary, artifact.summary)
158+
assertEquals(validMetrics.linesOfCodeChanged, artifact.metrics.linesOfCodeChanged)
159159
}
160160

161161
@Test

plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerTestBase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ open class CodeWhispererCodeModernizerTestBase(
134134
internal val validMetrics =
135135
CodeModernizerMetrics(
136136
charactersOfCodeChanged = 1234,
137-
linesOfCodeChanged = 567,
138-
linesOfCodeSubmitted = 8910,
137+
linesOfCodeChanged = 119,
138+
linesOfCodeSubmitted = 567,
139139
programmingLanguage = "JAVA",
140140
)
141141

0 commit comments

Comments
 (0)