From 494bd6ff76648cac22ed26fa9626dd56d410c79c Mon Sep 17 00:00:00 2001 From: Rui Hu Date: Tue, 12 Mar 2024 17:20:38 +0800 Subject: [PATCH] Add boilerplate for root project --- .../com/cleverthis/interview/Solution.java | 14 +++++++++ .../cleverthis/interview/SolutionTest.java | 30 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/main/java/com/cleverthis/interview/Solution.java create mode 100644 src/test/java/com/cleverthis/interview/SolutionTest.java diff --git a/src/main/java/com/cleverthis/interview/Solution.java b/src/main/java/com/cleverthis/interview/Solution.java new file mode 100644 index 0000000..851e01e --- /dev/null +++ b/src/main/java/com/cleverthis/interview/Solution.java @@ -0,0 +1,14 @@ +package com.cleverthis.interview; + +import com.cleverthis.interview.padlock.PadlockImpl; +import sun.reflect.generics.reflectiveObjects.NotImplementedException; + +/** + * This is a placeholder class showing a simple boilerplate. + * This class is not required, so you can replace with your own architecture. + * */ +public class Solution { + public void solve(PadlockImpl padlock) { + throw new RuntimeException("TODO"); + } +} diff --git a/src/test/java/com/cleverthis/interview/SolutionTest.java b/src/test/java/com/cleverthis/interview/SolutionTest.java new file mode 100644 index 0000000..64a0cdc --- /dev/null +++ b/src/test/java/com/cleverthis/interview/SolutionTest.java @@ -0,0 +1,30 @@ +package com.cleverthis.interview; + +import com.cleverthis.interview.padlock.PadlockImpl; +import org.junit.jupiter.api.Test; + +import java.util.Random; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * This is a simple placeholder to show how unit test works. + * You can replace it with your own test. + */ +class SolutionTest { + private void solve(PadlockImpl padlock) { + new Solution().solve(padlock); + } + + @Test + void verify(){ + Random random = new Random(); + PadlockImpl padlock = new PadlockImpl(random.nextInt(1, 8)); + + long startTime = System.currentTimeMillis(); + solve(padlock); + long endTime = System.currentTimeMillis(); + assertTrue(padlock.isPasscodeCorrect()); + System.out.println("Time usage: " + (endTime - startTime) + "ms"); + } +} \ No newline at end of file