Skip to content

Commit c937a61

Browse files
committed
#102 - Include last package in generated build method names
1 parent b23b505 commit c937a61

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

inject-generator/src/main/java/io/avaje/inject/generator/MetaData.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ String getBuildName() {
6161
if (Util.isVoid(type)) {
6262
return "void_" + Util.trimMethod(method);
6363
} else {
64+
String trimType = Util.trimMethod(type);
6465
if (name != null) {
65-
return shortType + "_" + name;
66+
return trimType + "_" + name;
6667
} else {
67-
return shortType;
68+
return trimType;
6869
}
6970
}
7071
}

inject-generator/src/test/java/io/avaje/inject/generator/UtilTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.junit.jupiter.api.Test;
44

5+
import static org.assertj.core.api.Assertions.assertThat;
56
import static org.junit.jupiter.api.Assertions.assertEquals;
67
import static org.junit.jupiter.api.Assertions.assertFalse;
78
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -52,4 +53,9 @@ public void validImportType_not() {
5253
assertFalse(Util.validImportType("Foo"));
5354
assertFalse(Util.validImportType("NoPackage"));
5455
}
56+
57+
@Test
58+
void shortMethod() {
59+
assertThat(Util.shortMethod("foo.bar.processMe")).isEqualTo("bar.processMe");
60+
}
5561
}

0 commit comments

Comments
 (0)