@alloy-js/java 0.24.0-dev.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/dev/src/components/Class.js +10 -10
- package/dist/dev/src/components/Class.js.map +1 -1
- package/dist/dev/src/components/Interface.js +8 -8
- package/dist/dev/src/components/Interface.js.map +1 -1
- package/dist/dev/src/components/ObjectDeclaration.js +2 -2
- package/dist/dev/src/components/ObjectDeclaration.js.map +1 -1
- package/dist/dev/test/annotation.test.js +100 -73
- package/dist/dev/test/annotation.test.js.map +1 -1
- package/dist/dev/test/class.test.js +248 -182
- package/dist/dev/test/class.test.js.map +1 -1
- package/dist/dev/test/constructor.test.js +114 -84
- package/dist/dev/test/constructor.test.js.map +1 -1
- package/dist/dev/test/enum.test.js +186 -141
- package/dist/dev/test/enum.test.js.map +1 -1
- package/dist/dev/test/externals.test.js +35 -52
- package/dist/dev/test/externals.test.js.map +1 -1
- package/dist/dev/test/interface.test.js +174 -125
- package/dist/dev/test/interface.test.js.map +1 -1
- package/dist/dev/test/method.test.js +311 -233
- package/dist/dev/test/method.test.js.map +1 -1
- package/dist/dev/test/package.test.js +29 -14
- package/dist/dev/test/package.test.js.map +1 -1
- package/dist/dev/test/reference.test.js +122 -91
- package/dist/dev/test/reference.test.js.map +1 -1
- package/dist/dev/test/type-arguments.test.js +114 -98
- package/dist/dev/test/type-arguments.test.js.map +1 -1
- package/dist/dev/test/utils.js +19 -67
- package/dist/dev/test/utils.js.map +1 -1
- package/dist/dev/test/values.test.js +5 -6
- package/dist/dev/test/values.test.js.map +1 -1
- package/dist/dev/test/variables.test.js +206 -159
- package/dist/dev/test/variables.test.js.map +1 -1
- package/dist/src/components/Class.d.ts.map +1 -1
- package/dist/src/components/Class.js.map +1 -1
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/ObjectDeclaration.d.ts.map +1 -1
- package/dist/src/components/ObjectDeclaration.js.map +1 -1
- package/dist/test/annotation.test.js +60 -49
- package/dist/test/annotation.test.js.map +1 -1
- package/dist/test/class.test.js +156 -122
- package/dist/test/class.test.js.map +1 -1
- package/dist/test/constructor.test.js +72 -58
- package/dist/test/constructor.test.js.map +1 -1
- package/dist/test/enum.test.js +111 -90
- package/dist/test/enum.test.js.map +1 -1
- package/dist/test/externals.test.js +23 -32
- package/dist/test/externals.test.js.map +1 -1
- package/dist/test/interface.test.js +105 -80
- package/dist/test/interface.test.js.map +1 -1
- package/dist/test/method.test.js +206 -168
- package/dist/test/method.test.js.map +1 -1
- package/dist/test/package.test.js +17 -10
- package/dist/test/package.test.js.map +1 -1
- package/dist/test/reference.test.js +66 -51
- package/dist/test/reference.test.js.map +1 -1
- package/dist/test/type-arguments.test.js +63 -55
- package/dist/test/type-arguments.test.js.map +1 -1
- package/dist/test/utils.d.ts +8 -5
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +16 -56
- package/dist/test/utils.js.map +1 -1
- package/dist/test/values.test.d.ts +1 -1
- package/dist/test/values.test.d.ts.map +1 -1
- package/dist/test/values.test.js +0 -1
- package/dist/test/values.test.js.map +1 -1
- package/dist/test/variables.test.js +139 -116
- package/dist/test/variables.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/index.md +0 -1
- package/docs/api/index.md +1 -1
- package/package.json +11 -10
- package/src/components/Class.tsx +1 -3
- package/src/components/Interface.tsx +1 -3
- package/src/components/ObjectDeclaration.tsx +1 -2
- package/temp/api.json +38 -14
- package/test/annotation.test.tsx +44 -41
- package/test/class.test.tsx +109 -103
- package/test/constructor.test.tsx +48 -52
- package/test/enum.test.tsx +82 -77
- package/test/externals.test.tsx +17 -20
- package/test/interface.test.tsx +70 -65
- package/test/method.test.tsx +154 -152
- package/test/package.test.tsx +11 -11
- package/test/reference.test.tsx +49 -50
- package/test/type-arguments.test.tsx +35 -35
- package/test/utils.tsx +15 -74
- package/test/values.test.tsx +0 -1
- package/test/variables.test.tsx +70 -69
- package/tsconfig.json +1 -1
- package/tsdoc-metadata.json +1 -1
- package/vitest.config.ts +1 -0
- package/docs/api/components/PomFile.md +0 -25
package/docs/api/index.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alloy-js/java",
|
|
3
|
-
"version": "0.24.0
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,18 +20,19 @@
|
|
|
20
20
|
"author": "brian.terlson@microsoft.com",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@alloy-js/core": "~0.23.0 || >= 0.24.0-dev.1",
|
|
24
23
|
"change-case": "^5.4.4",
|
|
25
|
-
"pathe": "^2.0.3"
|
|
24
|
+
"pathe": "^2.0.3",
|
|
25
|
+
"@alloy-js/core": "~0.24.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
28
|
+
"@microsoft/api-extractor": "~7.58.8",
|
|
29
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
30
|
+
"@types/node": "^25.9.2",
|
|
31
|
+
"concurrently": "^10.0.3",
|
|
32
|
+
"typescript": "^6.0.3",
|
|
33
|
+
"vitest": "4.1.8",
|
|
34
|
+
"@alloy-js/rollup-plugin": "~0.1.2",
|
|
35
|
+
"@alloy-js/cli": "~0.24.0"
|
|
35
36
|
},
|
|
36
37
|
"type": "module",
|
|
37
38
|
"scripts": {
|
package/src/components/Class.tsx
CHANGED
|
@@ -8,9 +8,7 @@ import { Name } from "./Name.js";
|
|
|
8
8
|
import { TypeParameters, TypeParametersProps } from "./TypeParameters.jsx";
|
|
9
9
|
|
|
10
10
|
export interface ClassProps
|
|
11
|
-
extends CommonDeclarationProps,
|
|
12
|
-
ModifierProps,
|
|
13
|
-
TypeParametersProps {
|
|
11
|
+
extends CommonDeclarationProps, ModifierProps, TypeParametersProps {
|
|
14
12
|
extends?: Children;
|
|
15
13
|
implements?: Children[];
|
|
16
14
|
}
|
|
@@ -7,9 +7,7 @@ import { Name } from "./Name.js";
|
|
|
7
7
|
import { TypeParameters, TypeParametersProps } from "./TypeParameters.jsx";
|
|
8
8
|
|
|
9
9
|
export interface InterfaceProps
|
|
10
|
-
extends CommonDeclarationProps,
|
|
11
|
-
ModifierProps,
|
|
12
|
-
TypeParametersProps {
|
|
10
|
+
extends CommonDeclarationProps, ModifierProps, TypeParametersProps {
|
|
13
11
|
extends?: Children[];
|
|
14
12
|
}
|
|
15
13
|
|
|
@@ -5,8 +5,7 @@ import { ModifierProps } from "./Modifiers.jsx";
|
|
|
5
5
|
import { Variable } from "./Variable.js";
|
|
6
6
|
|
|
7
7
|
export interface ObjectDeclarationProps
|
|
8
|
-
extends CommonDeclarationProps,
|
|
9
|
-
ModifierProps {
|
|
8
|
+
extends CommonDeclarationProps, ModifierProps {
|
|
10
9
|
type: Children;
|
|
11
10
|
args?: Children[];
|
|
12
11
|
}
|
package/temp/api.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metadata": {
|
|
3
3
|
"toolPackage": "@microsoft/api-extractor",
|
|
4
|
-
"toolVersion": "7.
|
|
4
|
+
"toolVersion": "7.58.8",
|
|
5
5
|
"schemaVersion": 1011,
|
|
6
6
|
"oldestForwardsCompatibleVersion": 1001,
|
|
7
7
|
"tsdocConfig": {
|
|
@@ -114,6 +114,22 @@
|
|
|
114
114
|
"tagName": "@virtual",
|
|
115
115
|
"syntaxKind": "modifier"
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
"tagName": "@jsx",
|
|
119
|
+
"syntaxKind": "block"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"tagName": "@jsxRuntime",
|
|
123
|
+
"syntaxKind": "block"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"tagName": "@jsxFrag",
|
|
127
|
+
"syntaxKind": "block"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"tagName": "@jsxImportSource",
|
|
131
|
+
"syntaxKind": "block"
|
|
132
|
+
},
|
|
117
133
|
{
|
|
118
134
|
"tagName": "@betaDocumentation",
|
|
119
135
|
"syntaxKind": "modifier"
|
|
@@ -175,7 +191,7 @@
|
|
|
175
191
|
{
|
|
176
192
|
"kind": "Function",
|
|
177
193
|
"canonicalReference": "@alloy-js/java!Annotation:function(1)",
|
|
178
|
-
"docComment": "/**\n * Use an annotation in code, not declaring a new annotation
|
|
194
|
+
"docComment": "/**\n * Use an annotation in code, not declaring a new annotation. For instance, use this if you want to annotate a method with '\\@Override'.\n */\n",
|
|
179
195
|
"excerptTokens": [
|
|
180
196
|
{
|
|
181
197
|
"kind": "Content",
|
|
@@ -309,7 +325,7 @@
|
|
|
309
325
|
{
|
|
310
326
|
"kind": "Function",
|
|
311
327
|
"canonicalReference": "@alloy-js/java!ArgumentList:function(1)",
|
|
312
|
-
"docComment": "/**\n * A list of arguments to be passed to a function, constructor, enum, and so
|
|
328
|
+
"docComment": "/**\n * A list of arguments to be passed to a function, constructor, enum, and so forth. Includes parenthesis when arguments are passed, otherwise returns an empty string.\n */\n",
|
|
313
329
|
"excerptTokens": [
|
|
314
330
|
{
|
|
315
331
|
"kind": "Content",
|
|
@@ -704,7 +720,7 @@
|
|
|
704
720
|
{
|
|
705
721
|
"kind": "Function",
|
|
706
722
|
"canonicalReference": "@alloy-js/java!Constructor:function(1)",
|
|
707
|
-
"docComment": "/**\n * Declare a constructor, usually for a class or enum
|
|
723
|
+
"docComment": "/**\n * Declare a constructor, usually for a class or enum If no name is provided, will try take name from class or enum declaration\n */\n",
|
|
708
724
|
"excerptTokens": [
|
|
709
725
|
{
|
|
710
726
|
"kind": "Content",
|
|
@@ -1151,7 +1167,7 @@
|
|
|
1151
1167
|
{
|
|
1152
1168
|
"kind": "Function",
|
|
1153
1169
|
"canonicalReference": "@alloy-js/java!Declaration:function(1)",
|
|
1154
|
-
"docComment": "/**\n * Declare a symbol in the program. Declaring classes, interfaces, enums, etc. Should also pass in
|
|
1170
|
+
"docComment": "/**\n * Declare a symbol in the program. Declaring classes, interfaces, enums, etc. Should also pass in access modifier so we can manage access\n */\n",
|
|
1155
1171
|
"excerptTokens": [
|
|
1156
1172
|
{
|
|
1157
1173
|
"kind": "Content",
|
|
@@ -1352,7 +1368,7 @@
|
|
|
1352
1368
|
{
|
|
1353
1369
|
"kind": "Function",
|
|
1354
1370
|
"canonicalReference": "@alloy-js/java!EnumMemberList:function(1)",
|
|
1355
|
-
"docComment": "/**\n * Create a list of enum members, joining with a comma and a hardline, and
|
|
1371
|
+
"docComment": "/**\n * Create a list of enum members, joining with a comma and a hardline, and ending with a semicolon.\n */\n",
|
|
1356
1372
|
"excerptTokens": [
|
|
1357
1373
|
{
|
|
1358
1374
|
"kind": "Content",
|
|
@@ -2551,7 +2567,7 @@
|
|
|
2551
2567
|
{
|
|
2552
2568
|
"kind": "Class",
|
|
2553
2569
|
"canonicalReference": "@alloy-js/java!JavaOutputSymbol:class",
|
|
2554
|
-
"docComment": "/**\n * Represents an 'exported' symbol from a .java file. Class, enum, interface etc
|
|
2570
|
+
"docComment": "/**\n * Represents an 'exported' symbol from a .java file. Class, enum, interface etc. Not considered exported if private\n */\n",
|
|
2555
2571
|
"excerptTokens": [
|
|
2556
2572
|
{
|
|
2557
2573
|
"kind": "Content",
|
|
@@ -3103,7 +3119,7 @@
|
|
|
3103
3119
|
{
|
|
3104
3120
|
"kind": "Property",
|
|
3105
3121
|
"canonicalReference": "@alloy-js/java!JavaProjectScope#dependencies:member",
|
|
3106
|
-
"docComment": "/**\n * The dependencies of this project
|
|
3122
|
+
"docComment": "/**\n * The dependencies of this project Map qualified package name to dependency\n */\n",
|
|
3107
3123
|
"excerptTokens": [
|
|
3108
3124
|
{
|
|
3109
3125
|
"kind": "Content",
|
|
@@ -4167,7 +4183,7 @@
|
|
|
4167
4183
|
{
|
|
4168
4184
|
"kind": "Interface",
|
|
4169
4185
|
"canonicalReference": "@alloy-js/java!ModifierProps:interface",
|
|
4170
|
-
"docComment": "/**\n * Objects extend this interface to allow to take modifiers as boolean props
|
|
4186
|
+
"docComment": "/**\n * Objects extend this interface to allow to take modifiers as boolean props. Then can declare components like so\n *\n * `<Class public final abstract />`\n *\n * Error will be thrown if try to specify multiple access modifiers\n */\n",
|
|
4171
4187
|
"excerptTokens": [
|
|
4172
4188
|
{
|
|
4173
4189
|
"kind": "Content",
|
|
@@ -4745,7 +4761,7 @@
|
|
|
4745
4761
|
{
|
|
4746
4762
|
"kind": "Function",
|
|
4747
4763
|
"canonicalReference": "@alloy-js/java!ObjectDeclaration:function(1)",
|
|
4748
|
-
"docComment": "/**\n * Shorthand to instantiate a new object
|
|
4764
|
+
"docComment": "/**\n * Shorthand to instantiate a new object. Declares it with 'new' and passes arguments to the constructor of the object, if any\n */\n",
|
|
4749
4765
|
"excerptTokens": [
|
|
4750
4766
|
{
|
|
4751
4767
|
"kind": "Content",
|
|
@@ -5308,7 +5324,7 @@
|
|
|
5308
5324
|
"excerptTokens": [
|
|
5309
5325
|
{
|
|
5310
5326
|
"kind": "Content",
|
|
5311
|
-
"text": "export declare function PomFile(
|
|
5327
|
+
"text": "export declare function PomFile(input: "
|
|
5312
5328
|
},
|
|
5313
5329
|
{
|
|
5314
5330
|
"kind": "Reference",
|
|
@@ -5339,6 +5355,14 @@
|
|
|
5339
5355
|
"parameters": [
|
|
5340
5356
|
{
|
|
5341
5357
|
"parameterName": "{ projectConfig }",
|
|
5358
|
+
"parameterTypeTokenRange": {
|
|
5359
|
+
"startIndex": 0,
|
|
5360
|
+
"endIndex": 0
|
|
5361
|
+
},
|
|
5362
|
+
"isOptional": false
|
|
5363
|
+
},
|
|
5364
|
+
{
|
|
5365
|
+
"parameterName": "input",
|
|
5342
5366
|
"parameterTypeTokenRange": {
|
|
5343
5367
|
"startIndex": 1,
|
|
5344
5368
|
"endIndex": 2
|
|
@@ -5527,7 +5551,7 @@
|
|
|
5527
5551
|
{
|
|
5528
5552
|
"kind": "Function",
|
|
5529
5553
|
"canonicalReference": "@alloy-js/java!ProjectDirectory:function(1)",
|
|
5530
|
-
"docComment": "/**\n * Represents a java project directory. Use if you want to generate a Java project
|
|
5554
|
+
"docComment": "/**\n * Represents a java project directory. Use if you want to generate a Java project with a build tool included (maven, gradle etc).\n */\n",
|
|
5531
5555
|
"excerptTokens": [
|
|
5532
5556
|
{
|
|
5533
5557
|
"kind": "Content",
|
|
@@ -5645,7 +5669,7 @@
|
|
|
5645
5669
|
{
|
|
5646
5670
|
"kind": "PropertySignature",
|
|
5647
5671
|
"canonicalReference": "@alloy-js/java!ProjectDirectoryProps#mavenProjectConfig:member",
|
|
5648
|
-
"docComment": "/**\n * Specify project configuration for either maven or gradle
|
|
5672
|
+
"docComment": "/**\n * Specify project configuration for either maven or gradle. If not specified, will create generic Java project\n */\n",
|
|
5649
5673
|
"excerptTokens": [
|
|
5650
5674
|
{
|
|
5651
5675
|
"kind": "Content",
|
|
@@ -6167,7 +6191,7 @@
|
|
|
6167
6191
|
{
|
|
6168
6192
|
"kind": "Function",
|
|
6169
6193
|
"canonicalReference": "@alloy-js/java!TypeArguments:function(1)",
|
|
6170
|
-
"docComment": "/**\n * Type arguments for a generic type. Can be called with either an array of
|
|
6194
|
+
"docComment": "/**\n * Type arguments for a generic type. Can be called with either an array of Children which are rendered as type arguments, or an array of {@link TypeArgumentDescriptor}s which allow for specifying use-site variance.\n */\n",
|
|
6171
6195
|
"excerptTokens": [
|
|
6172
6196
|
{
|
|
6173
6197
|
"kind": "Content",
|
package/test/annotation.test.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { d } from "@alloy-js/core/testing";
|
|
2
1
|
import { expect, it } from "vitest";
|
|
3
2
|
import * as jv from "../src/components/index.js";
|
|
4
|
-
import {
|
|
3
|
+
import { TestPackage } from "./utils.js";
|
|
5
4
|
|
|
6
5
|
it("Annotates object", () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
expect(
|
|
7
|
+
<TestPackage>
|
|
8
|
+
<jv.Annotation type="Getter" />
|
|
9
|
+
</TestPackage>,
|
|
10
|
+
).toRenderTo(`
|
|
10
11
|
package me.test.code;
|
|
11
12
|
|
|
12
13
|
@Getter
|
|
@@ -14,14 +15,14 @@ it("Annotates object", () => {
|
|
|
14
15
|
});
|
|
15
16
|
|
|
16
17
|
it("Takes single parameter", () => {
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
expect(
|
|
19
|
+
<TestPackage>
|
|
20
|
+
<jv.Annotation
|
|
21
|
+
type="Getter"
|
|
22
|
+
value={{ value: <jv.Value value="Test" /> }}
|
|
23
|
+
/>
|
|
24
|
+
</TestPackage>,
|
|
25
|
+
).toRenderTo(`
|
|
25
26
|
package me.test.code;
|
|
26
27
|
|
|
27
28
|
@Getter("Test")
|
|
@@ -29,17 +30,17 @@ it("Takes single parameter", () => {
|
|
|
29
30
|
});
|
|
30
31
|
|
|
31
32
|
it("Takes named parameters", () => {
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
expect(
|
|
34
|
+
<TestPackage>
|
|
35
|
+
<jv.Annotation
|
|
36
|
+
type="Getter"
|
|
37
|
+
value={{
|
|
38
|
+
value1: <jv.Value value="Tester" />,
|
|
39
|
+
value2: <jv.Value value="Tested" />,
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
</TestPackage>,
|
|
43
|
+
).toRenderTo(`
|
|
43
44
|
package me.test.code;
|
|
44
45
|
|
|
45
46
|
@Getter(value1 = "Tester", value2 = "Tested")
|
|
@@ -47,23 +48,25 @@ it("Takes named parameters", () => {
|
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
it("breaks named parameters across multiple lines", () => {
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
expect(
|
|
52
|
+
<TestPackage>
|
|
53
|
+
<jv.Annotation
|
|
54
|
+
type="Getter"
|
|
55
|
+
value={{
|
|
56
|
+
value1: <jv.Value value="Tester" />,
|
|
57
|
+
value2: <jv.Value value="Tested" />,
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
</TestPackage>,
|
|
61
|
+
).toRenderTo(
|
|
62
|
+
`
|
|
63
|
+
package me.test.code;
|
|
64
|
+
|
|
65
|
+
@Getter(
|
|
66
|
+
value1 = "Tester",
|
|
67
|
+
value2 = "Tested"
|
|
68
|
+
)
|
|
69
|
+
`,
|
|
58
70
|
{ printWidth: 20 },
|
|
59
71
|
);
|
|
60
|
-
|
|
61
|
-
expect(res).toBe(d`
|
|
62
|
-
package me.test.code;
|
|
63
|
-
|
|
64
|
-
@Getter(
|
|
65
|
-
value1 = "Tester",
|
|
66
|
-
value2 = "Tested"
|
|
67
|
-
)
|
|
68
|
-
`);
|
|
69
72
|
});
|
package/test/class.test.tsx
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { code, namekey, refkey } from "@alloy-js/core";
|
|
2
|
-
import { d } from "@alloy-js/core/testing";
|
|
1
|
+
import { code, namekey, Output, refkey } from "@alloy-js/core";
|
|
3
2
|
import { expect, it } from "vitest";
|
|
4
3
|
import * as jv from "../src/components/index.js";
|
|
5
|
-
import {
|
|
4
|
+
import { TestPackage } from "./utils.js";
|
|
6
5
|
|
|
7
6
|
it("works", () => {
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
expect(
|
|
8
|
+
<TestPackage>
|
|
9
|
+
<jv.Class public abstract final name="TestClass"></jv.Class>
|
|
10
|
+
</TestPackage>,
|
|
11
|
+
).toRenderTo(`
|
|
13
12
|
package me.test.code;
|
|
14
13
|
|
|
15
14
|
public abstract final class TestClass {}
|
|
@@ -17,11 +16,11 @@ it("works", () => {
|
|
|
17
16
|
});
|
|
18
17
|
|
|
19
18
|
it("takes a namekey", () => {
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
expect(
|
|
20
|
+
<TestPackage>
|
|
21
|
+
<jv.Class public abstract final name={namekey("TestClass")}></jv.Class>
|
|
22
|
+
</TestPackage>,
|
|
23
|
+
).toRenderTo(`
|
|
25
24
|
package me.test.code;
|
|
26
25
|
|
|
27
26
|
public abstract final class TestClass {}
|
|
@@ -29,29 +28,30 @@ it("takes a namekey", () => {
|
|
|
29
28
|
});
|
|
30
29
|
|
|
31
30
|
it("extends class", () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<jv.
|
|
35
|
-
<jv.
|
|
36
|
-
public
|
|
37
|
-
name="TestSuperclass"
|
|
38
|
-
refkey={refkey("TestSuperclass")}
|
|
39
|
-
></jv.Class>
|
|
40
|
-
</jv.SourceFile>
|
|
41
|
-
<jv.PackageDirectory package="import">
|
|
42
|
-
<jv.SourceFile path="TestSubclass.java">
|
|
31
|
+
expect(
|
|
32
|
+
<Output>
|
|
33
|
+
<jv.PackageDirectory package="me.test.code">
|
|
34
|
+
<jv.SourceFile path="TestSuperclass.java">
|
|
43
35
|
<jv.Class
|
|
44
36
|
public
|
|
45
|
-
name="
|
|
46
|
-
|
|
37
|
+
name="TestSuperclass"
|
|
38
|
+
refkey={refkey("TestSuperclass")}
|
|
47
39
|
></jv.Class>
|
|
48
40
|
</jv.SourceFile>
|
|
41
|
+
<jv.PackageDirectory package="import">
|
|
42
|
+
<jv.SourceFile path="TestSubclass.java">
|
|
43
|
+
<jv.Class
|
|
44
|
+
public
|
|
45
|
+
name="TestSubclass"
|
|
46
|
+
extends={refkey("TestSuperclass")}
|
|
47
|
+
></jv.Class>
|
|
48
|
+
</jv.SourceFile>
|
|
49
|
+
</jv.PackageDirectory>
|
|
49
50
|
</jv.PackageDirectory>
|
|
50
|
-
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"TestSubclass.java": d`
|
|
51
|
+
</Output>,
|
|
52
|
+
).toRenderTo({
|
|
53
|
+
"me/test/code/TestSuperclass.java": expect.any(String),
|
|
54
|
+
"me/test/code/import/TestSubclass.java": `
|
|
55
55
|
package me.test.code.import;
|
|
56
56
|
|
|
57
57
|
import me.test.code.TestSuperclass;
|
|
@@ -62,38 +62,40 @@ it("extends class", () => {
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
it("implements interfaces", () => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<jv.
|
|
68
|
-
<jv.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<jv.SourceFile path="InterfaceTwo.java">
|
|
76
|
-
<jv.Declaration name="InterfaceTwo">
|
|
77
|
-
{code`
|
|
78
|
-
public interface InterfaceTwo {
|
|
79
|
-
}
|
|
80
|
-
`}
|
|
81
|
-
</jv.Declaration>
|
|
82
|
-
</jv.SourceFile>
|
|
83
|
-
<jv.PackageDirectory package="import">
|
|
84
|
-
<jv.SourceFile path="TestSubclass.java">
|
|
85
|
-
<jv.Class
|
|
86
|
-
public
|
|
87
|
-
name="TestSubclass"
|
|
88
|
-
implements={[refkey("InterfaceOne"), refkey("InterfaceTwo")]}
|
|
89
|
-
></jv.Class>
|
|
65
|
+
expect(
|
|
66
|
+
<Output>
|
|
67
|
+
<jv.PackageDirectory package="me.test.code">
|
|
68
|
+
<jv.SourceFile path="InterfaceOne.java">
|
|
69
|
+
<jv.Declaration name="InterfaceOne">
|
|
70
|
+
{code`
|
|
71
|
+
public interface InterfaceOne {
|
|
72
|
+
}
|
|
73
|
+
`}
|
|
74
|
+
</jv.Declaration>
|
|
90
75
|
</jv.SourceFile>
|
|
76
|
+
<jv.SourceFile path="InterfaceTwo.java">
|
|
77
|
+
<jv.Declaration name="InterfaceTwo">
|
|
78
|
+
{code`
|
|
79
|
+
public interface InterfaceTwo {
|
|
80
|
+
}
|
|
81
|
+
`}
|
|
82
|
+
</jv.Declaration>
|
|
83
|
+
</jv.SourceFile>
|
|
84
|
+
<jv.PackageDirectory package="import">
|
|
85
|
+
<jv.SourceFile path="TestSubclass.java">
|
|
86
|
+
<jv.Class
|
|
87
|
+
public
|
|
88
|
+
name="TestSubclass"
|
|
89
|
+
implements={[refkey("InterfaceOne"), refkey("InterfaceTwo")]}
|
|
90
|
+
></jv.Class>
|
|
91
|
+
</jv.SourceFile>
|
|
92
|
+
</jv.PackageDirectory>
|
|
91
93
|
</jv.PackageDirectory>
|
|
92
|
-
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"TestSubclass.java":
|
|
94
|
+
</Output>,
|
|
95
|
+
).toRenderTo({
|
|
96
|
+
"me/test/code/InterfaceOne.java": expect.any(String),
|
|
97
|
+
"me/test/code/InterfaceTwo.java": expect.any(String),
|
|
98
|
+
"me/test/code/import/TestSubclass.java": `
|
|
97
99
|
package me.test.code.import;
|
|
98
100
|
|
|
99
101
|
import me.test.code.InterfaceOne;
|
|
@@ -105,50 +107,54 @@ it("implements interfaces", () => {
|
|
|
105
107
|
});
|
|
106
108
|
|
|
107
109
|
it("defines generics", () => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<jv.
|
|
111
|
-
<jv.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<jv.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<jv.PackageDirectory package="import">
|
|
127
|
-
<jv.SourceFile path="TestGenerics.java">
|
|
128
|
-
<jv.Class
|
|
129
|
-
public
|
|
130
|
-
name="TestGenerics"
|
|
131
|
-
generics={{
|
|
132
|
-
T: refkey("TypeOne"),
|
|
133
|
-
N: refkey("TypeTwo"),
|
|
134
|
-
J: "String",
|
|
135
|
-
K: "",
|
|
136
|
-
}}
|
|
137
|
-
></jv.Class>
|
|
110
|
+
expect(
|
|
111
|
+
<Output>
|
|
112
|
+
<jv.PackageDirectory package="me.test.code">
|
|
113
|
+
<jv.SourceFile path="TypeOne.java">
|
|
114
|
+
<jv.Declaration name="TypeOne">
|
|
115
|
+
{code`
|
|
116
|
+
public interface TypeOne {
|
|
117
|
+
}
|
|
118
|
+
`}
|
|
119
|
+
</jv.Declaration>
|
|
120
|
+
</jv.SourceFile>
|
|
121
|
+
<jv.SourceFile path="TypeTwo.java">
|
|
122
|
+
<jv.Declaration name="TypeTwo">
|
|
123
|
+
{code`
|
|
124
|
+
public interface TypeTwo {
|
|
125
|
+
}
|
|
126
|
+
`}
|
|
127
|
+
</jv.Declaration>
|
|
138
128
|
</jv.SourceFile>
|
|
129
|
+
<jv.PackageDirectory package="import">
|
|
130
|
+
<jv.SourceFile path="TestGenerics.java">
|
|
131
|
+
<jv.Class
|
|
132
|
+
public
|
|
133
|
+
name="TestGenerics"
|
|
134
|
+
generics={{
|
|
135
|
+
T: refkey("TypeOne"),
|
|
136
|
+
N: refkey("TypeTwo"),
|
|
137
|
+
J: "String",
|
|
138
|
+
K: "",
|
|
139
|
+
}}
|
|
140
|
+
></jv.Class>
|
|
141
|
+
</jv.SourceFile>
|
|
142
|
+
</jv.PackageDirectory>
|
|
139
143
|
</jv.PackageDirectory>
|
|
140
|
-
|
|
144
|
+
</Output>,
|
|
145
|
+
).toRenderTo(
|
|
146
|
+
{
|
|
147
|
+
"me/test/code/TypeOne.java": expect.any(String),
|
|
148
|
+
"me/test/code/TypeTwo.java": expect.any(String),
|
|
149
|
+
"me/test/code/import/TestGenerics.java": `
|
|
150
|
+
package me.test.code.import;
|
|
151
|
+
|
|
152
|
+
import me.test.code.TypeOne;
|
|
153
|
+
import me.test.code.TypeTwo;
|
|
154
|
+
|
|
155
|
+
public class TestGenerics<T extends TypeOne, N extends TypeTwo, J extends String, K> {}
|
|
156
|
+
`,
|
|
157
|
+
},
|
|
141
158
|
{ printWidth: 100 },
|
|
142
159
|
);
|
|
143
|
-
|
|
144
|
-
assertFileContents(res, {
|
|
145
|
-
"TestGenerics.java": d`
|
|
146
|
-
package me.test.code.import;
|
|
147
|
-
|
|
148
|
-
import me.test.code.TypeOne;
|
|
149
|
-
import me.test.code.TypeTwo;
|
|
150
|
-
|
|
151
|
-
public class TestGenerics<T extends TypeOne, N extends TypeTwo, J extends String, K> {}
|
|
152
|
-
`,
|
|
153
|
-
});
|
|
154
160
|
});
|