import scala.io.Source
import org.junit.Test
import org.junit.Assert.*

class Day1Test:
  val sample =
    """199
      |200
      |208
      |210
      |200
      |207
      |240
      |269
      |260
      |263
      |""".stripMargin

  @Test def t1(): Unit =
    val solve = Day1.parse andThen Day1.part1
    assertEquals(7, solve(sample))
    assertEquals(1709, solve(Source.fromResource("day1").mkString))

  @Test def t2(): Unit =
    val solve = Day1.parse andThen Day1.part2
    assertEquals(5, solve(sample))
    assertEquals(1761, solve(Source.fromResource("day1").mkString))

import scala.io.Source
import org.junit.Test
import org.junit.Assert.*

class Day1Test:
  val sample =
    """199
      |200
      |208
      |210
      |200
      |207
      |240
      |269
      |260
      |263
      |""".stripMargin

  @Test def t1(): Unit =
    assertEquals(7, Day1.part1(Day1.parse(sample)))
    assertEquals(1709, Day1.part1(Day1.parse(Source.fromResource("day1").mkString)))

  @Test def t2(): Unit =
    assertEquals(5, Day1.part2(Day1.parse(sample)))
    assertEquals(1761, Day1.part2(Day1.parse(Source.fromResource("day1").mkString)))

--- 
+++ 
@@ -17,9 +17,11 @@
       |""".stripMargin
 
   @Test def t1(): Unit =
-    assertEquals(7, Day1.part1(Day1.parse(sample)))
-    assertEquals(1709, Day1.part1(Day1.parse(Source.fromResource("day1").mkString)))
+    val solve = Day1.parse andThen Day1.part1
+    assertEquals(7, solve(sample))
+    assertEquals(1709, solve(Source.fromResource("day1").mkString))
 
   @Test def t2(): Unit =
-    assertEquals(5, Day1.part2(Day1.parse(sample)))
-    assertEquals(1761, Day1.part2(Day1.parse(Source.fromResource("day1").mkString)))
+    val solve = Day1.parse andThen Day1.part2
+    assertEquals(5, solve(sample))
+    assertEquals(1761, solve(Source.fromResource("day1").mkString))
Use function composition to reduce some clutter.
