Skip to content

Commit da7d356

Browse files
authored
Merge pull request #95 from Natifishman/feature/tests
Test: Add Test Infrastructure
2 parents c719b42 + 3e8fe15 commit da7d356

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

app/src/test/java/com/example/partymaker/repository/GroupRepositoryTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void setUp() {
5858
public void testGetGroup_CacheHit_ReturnsFromCache() {
5959
// Given
6060
String groupKey = "test-group-key";
61-
Group mockGroup = createMockGroup(groupKey, "Test Group");
61+
Group mockGroup = createMockGroup(groupKey);
6262

6363
doAnswer(
6464
invocation -> {
@@ -99,7 +99,7 @@ public void onError(String error) {
9999
public void testGetGroup_CacheMiss_FallsBackToRemote() {
100100
// Given
101101
String groupKey = "test-group-key";
102-
Group mockGroup = createMockGroup(groupKey, "Test Group");
102+
Group mockGroup = createMockGroup(groupKey);
103103

104104
// Mock cache miss
105105
doAnswer(
@@ -159,7 +159,7 @@ public void onError(String error) {
159159
public void testGetGroup_ForceRefresh_SkipsCache() {
160160
// Given
161161
String groupKey = "test-group-key";
162-
Group mockGroup = createMockGroup(groupKey, "Test Group");
162+
Group mockGroup = createMockGroup(groupKey);
163163

164164
// Mock successful remote fetch
165165
doAnswer(
@@ -200,7 +200,7 @@ public void onError(String error) {
200200
public void testSaveGroup_Success_SavesRemoteAndLocal() {
201201
// Given
202202
String groupKey = "test-group-key";
203-
Group mockGroup = createMockGroup(groupKey, "Test Group");
203+
Group mockGroup = createMockGroup(groupKey);
204204

205205
// Mock successful remote save
206206
doAnswer(
@@ -247,7 +247,7 @@ public void onError(String error) {
247247
public void testObserveGroup_ReturnsLiveData() {
248248
// Given
249249
String groupKey = "test-group-key";
250-
Group mockGroup = createMockGroup(groupKey, "Test Group");
250+
Group mockGroup = createMockGroup(groupKey);
251251
MutableLiveData<Group> mockLiveData = new MutableLiveData<>();
252252
mockLiveData.setValue(mockGroup);
253253

@@ -263,10 +263,10 @@ public void testObserveGroup_ReturnsLiveData() {
263263
}
264264

265265
/** Helper method to create a mock Group for testing. */
266-
private Group createMockGroup(String key, String name) {
266+
private Group createMockGroup(String key) {
267267
Group group = new Group();
268268
group.setGroupKey(key);
269-
group.setGroupName(name);
269+
group.setGroupName("Test Group");
270270
group.setGroupLocation("Test Location");
271271
group.setAdminKey("test-admin");
272272
return group;

build.gradle.kts

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,54 @@ plugins {
1010

1111
buildscript {
1212
repositories {
13+
// Use Google's Maven repository first for Android dependencies
1314
google()
15+
// Use Maven Central for other dependencies
1416
mavenCentral()
17+
// Use Gradle Plugin Portal for Gradle plugins
18+
gradlePluginPortal()
1519
}
1620
dependencies {
1721
// Plugin for managing secrets (API keys, etc.)
1822
classpath(libs.secrets.gradle.plugin)
23+
24+
// Build optimization plugins
25+
classpath("com.getkeepsafe.dexcount:dexcount-gradle-plugin:4.0.0")
26+
classpath("com.github.ben-manes:gradle-versions-plugin:0.52.0")
1927
}
2028
}
2129

2230
// Configure all projects in the build
2331
allprojects {
32+
2433
// Apply common configurations to all modules
2534
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
2635
compilerOptions {
27-
// Enable Java 8 compatibility
36+
// Enable Java 11 compatibility
2837
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
2938

30-
// Use the experimental Kotlin compiler
31-
freeCompilerArgs.add("-Xopt-in=kotlin.RequiresOptIn")
39+
// Kotlin compiler optimizations
40+
freeCompilerArgs.addAll(listOf(
41+
"-Xopt-in=kotlin.RequiresOptIn",
42+
"-Xjvm-default=all",
43+
"-Xuse-k2" // Use K2 compiler for better performance
44+
))
3245
}
3346
}
3447

3548
tasks.withType<JavaCompile>().configureEach {
3649
sourceCompatibility = JavaVersion.VERSION_11.toString()
3750
targetCompatibility = JavaVersion.VERSION_11.toString()
51+
52+
// Java compiler optimizations
53+
options.apply {
54+
isIncremental = true
55+
isFork = true
56+
compilerArgs.addAll(listOf(
57+
"-Xlint:none", // Disable lint warnings for faster compilation
58+
"-nowarn" // Suppress warnings
59+
))
60+
}
3861
}
3962
}
4063

@@ -51,4 +74,15 @@ tasks.withType<Delete> {
5174
}
5275
}
5376

77+
// Build performance monitoring (configuration cache compatible)
78+
tasks.register("buildTimeReport") {
79+
group = "build performance"
80+
description = "Reports build performance metrics"
81+
82+
doLast {
83+
println("Build performance monitoring available")
84+
println("Use --scan flag for detailed build insights")
85+
}
86+
}
87+
5488
// No dependencies or configuration should be added here unless it applies to ALL modules.

0 commit comments

Comments
 (0)