Seth 6 年之前
父節點
當前提交
5924ba32b9

+ 1
- 0
.idea/.name 查看文件

@@ -0,0 +1 @@
1
+generics

+ 16
- 0
.idea/compiler.xml 查看文件

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="CompilerConfiguration">
4
+    <annotationProcessing>
5
+      <profile name="Maven default annotation processors profile" enabled="true">
6
+        <sourceOutputDir name="target/generated-sources/annotations" />
7
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8
+        <outputRelativeToContentRoot value="true" />
9
+        <module name="generics" />
10
+      </profile>
11
+    </annotationProcessing>
12
+    <bytecodeTargetLevel>
13
+      <module name="generics" target="1.7" />
14
+    </bytecodeTargetLevel>
15
+  </component>
16
+</project>

+ 13
- 0
.idea/libraries/Maven__junit_junit_4_12.xml 查看文件

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: junit:junit:4.12">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml 查看文件

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: org.hamcrest:hamcrest-core:1.3">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/misc.xml 查看文件

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="MavenProjectsManager">
4
+    <option name="originalFiles">
5
+      <list>
6
+        <option value="$PROJECT_DIR$/pom.xml" />
7
+      </list>
8
+    </option>
9
+  </component>
10
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
11
+    <output url="file://$PROJECT_DIR$/classes" />
12
+  </component>
13
+</project>

+ 8
- 0
.idea/modules.xml 查看文件

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/generics.iml" filepath="$PROJECT_DIR$/generics.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6
- 0
.idea/vcs.xml 查看文件

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 350
- 0
.idea/workspace.xml 查看文件

@@ -0,0 +1,350 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="7ad04558-d1a8-448f-add7-490f9c754201" name="Default Changelist" comment="">
5
+      <change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
6
+      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__junit_junit_4_12.xml" afterDir="false" />
7
+      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml" afterDir="false" />
8
+      <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
9
+      <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
10
+      <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
11
+      <change afterPath="$PROJECT_DIR$/generics.iml" afterDir="false" />
12
+      <change afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
13
+      <change afterPath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" afterDir="false" />
14
+      <change beforePath="$PROJECT_DIR$/src/main/java/.deleteme" beforeDir="false" />
15
+      <change beforePath="$PROJECT_DIR$/src/test/java/.deleteme" beforeDir="false" />
16
+    </list>
17
+    <ignored path="$PROJECT_DIR$/target/" />
18
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
19
+    <option name="SHOW_DIALOG" value="false" />
20
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
21
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
22
+    <option name="LAST_RESOLUTION" value="IGNORE" />
23
+  </component>
24
+  <component name="FUSProjectUsageTrigger">
25
+    <session id="-1050610943">
26
+      <usages-collector id="statistics.lifecycle.project">
27
+        <counts>
28
+          <entry key="project.open.time.0" value="1" />
29
+          <entry key="project.opened" value="1" />
30
+        </counts>
31
+      </usages-collector>
32
+      <usages-collector id="statistics.file.extensions.open">
33
+        <counts>
34
+          <entry key="gitignore" value="1" />
35
+          <entry key="java" value="3" />
36
+        </counts>
37
+      </usages-collector>
38
+      <usages-collector id="statistics.file.types.open">
39
+        <counts>
40
+          <entry key="JAVA" value="3" />
41
+          <entry key="PLAIN_TEXT" value="1" />
42
+        </counts>
43
+      </usages-collector>
44
+      <usages-collector id="statistics.file.extensions.edit">
45
+        <counts>
46
+          <entry key="java" value="1080" />
47
+        </counts>
48
+      </usages-collector>
49
+      <usages-collector id="statistics.file.types.edit">
50
+        <counts>
51
+          <entry key="JAVA" value="1080" />
52
+        </counts>
53
+      </usages-collector>
54
+    </session>
55
+  </component>
56
+  <component name="FileEditorManager">
57
+    <leaf>
58
+      <file pinned="false" current-in-tab="true">
59
+        <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
60
+          <provider selected="true" editor-type-id="text-editor">
61
+            <state relative-caret-position="465">
62
+              <caret line="31" column="44" selection-start-line="31" selection-start-column="44" selection-end-line="31" selection-end-column="44" />
63
+              <folding>
64
+                <element signature="imports" expanded="true" />
65
+                <element signature="e#143#144#0" expanded="true" />
66
+                <element signature="e#182#183#0" expanded="true" />
67
+              </folding>
68
+            </state>
69
+          </provider>
70
+        </entry>
71
+      </file>
72
+      <file pinned="false" current-in-tab="false">
73
+        <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
74
+          <provider selected="true" editor-type-id="text-editor">
75
+            <state relative-caret-position="360">
76
+              <caret line="26" column="13" lean-forward="true" selection-start-line="26" selection-start-column="13" selection-end-line="26" selection-end-column="13" />
77
+              <folding>
78
+                <element signature="e#338#339#0" expanded="true" />
79
+                <element signature="e#372#373#0" expanded="true" />
80
+              </folding>
81
+            </state>
82
+          </provider>
83
+        </entry>
84
+      </file>
85
+    </leaf>
86
+  </component>
87
+  <component name="FileTemplateManagerImpl">
88
+    <option name="RECENT_TEMPLATES">
89
+      <list>
90
+        <option value="Class" />
91
+      </list>
92
+    </option>
93
+  </component>
94
+  <component name="Git.Settings">
95
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
96
+  </component>
97
+  <component name="IdeDocumentHistory">
98
+    <option name="CHANGED_PATHS">
99
+      <list>
100
+        <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
101
+        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
102
+      </list>
103
+    </option>
104
+  </component>
105
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
106
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
107
+  <component name="JsGulpfileManager">
108
+    <detection-done>true</detection-done>
109
+    <sorting>DEFINITION_ORDER</sorting>
110
+  </component>
111
+  <component name="ProjectFrameBounds">
112
+    <option name="y" value="23" />
113
+    <option name="width" value="1440" />
114
+    <option name="height" value="807" />
115
+  </component>
116
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
117
+  <component name="ProjectView">
118
+    <navigator proportions="" version="1">
119
+      <foldersAlwaysOnTop value="true" />
120
+    </navigator>
121
+    <panes>
122
+      <pane id="PackagesPane" />
123
+      <pane id="ProjectPane">
124
+        <subPane>
125
+          <expand>
126
+            <path>
127
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
128
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
129
+            </path>
130
+            <path>
131
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
132
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
133
+              <item name="src" type="462c0819:PsiDirectoryNode" />
134
+            </path>
135
+            <path>
136
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
137
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
138
+              <item name="src" type="462c0819:PsiDirectoryNode" />
139
+              <item name="main" type="462c0819:PsiDirectoryNode" />
140
+            </path>
141
+            <path>
142
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
143
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
144
+              <item name="src" type="462c0819:PsiDirectoryNode" />
145
+              <item name="main" type="462c0819:PsiDirectoryNode" />
146
+              <item name="java" type="462c0819:PsiDirectoryNode" />
147
+            </path>
148
+            <path>
149
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
150
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
151
+              <item name="src" type="462c0819:PsiDirectoryNode" />
152
+              <item name="test" type="462c0819:PsiDirectoryNode" />
153
+            </path>
154
+            <path>
155
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
156
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
157
+              <item name="src" type="462c0819:PsiDirectoryNode" />
158
+              <item name="test" type="462c0819:PsiDirectoryNode" />
159
+              <item name="java" type="462c0819:PsiDirectoryNode" />
160
+            </path>
161
+          </expand>
162
+          <select />
163
+        </subPane>
164
+      </pane>
165
+      <pane id="Scope" />
166
+    </panes>
167
+  </component>
168
+  <component name="PropertiesComponent">
169
+    <property name="WebServerToolWindowFactoryState" value="false" />
170
+    <property name="aspect.path.notification.shown" value="true" />
171
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542151954778" />
172
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
173
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
174
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
175
+    <property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
176
+  </component>
177
+  <component name="RunDashboard">
178
+    <option name="ruleStates">
179
+      <list>
180
+        <RuleState>
181
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
182
+        </RuleState>
183
+        <RuleState>
184
+          <option name="name" value="StatusDashboardGroupingRule" />
185
+        </RuleState>
186
+      </list>
187
+    </option>
188
+  </component>
189
+  <component name="RunManager" selected="JUnit.MyArrayListTest.sizeAddTest">
190
+    <configuration name="MyArrayListTest.sizeAddTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
191
+      <module name="generics" />
192
+      <option name="PACKAGE_NAME" value="" />
193
+      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
194
+      <option name="METHOD_NAME" value="sizeAddTest" />
195
+      <option name="TEST_OBJECT" value="method" />
196
+      <method v="2">
197
+        <option name="Make" enabled="true" />
198
+      </method>
199
+    </configuration>
200
+    <configuration name="MyArrayListTest.sizeNoElementsTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
201
+      <module name="generics" />
202
+      <option name="PACKAGE_NAME" value="" />
203
+      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
204
+      <option name="METHOD_NAME" value="sizeNoElementsTest" />
205
+      <option name="TEST_OBJECT" value="method" />
206
+      <method v="2">
207
+        <option name="Make" enabled="true" />
208
+      </method>
209
+    </configuration>
210
+    <list>
211
+      <item itemvalue="JUnit.MyArrayListTest.sizeAddTest" />
212
+      <item itemvalue="JUnit.MyArrayListTest.sizeNoElementsTest" />
213
+    </list>
214
+    <recent_temporary>
215
+      <list>
216
+        <item itemvalue="JUnit.MyArrayListTest.sizeAddTest" />
217
+        <item itemvalue="JUnit.MyArrayListTest.sizeNoElementsTest" />
218
+      </list>
219
+    </recent_temporary>
220
+  </component>
221
+  <component name="SvnConfiguration">
222
+    <configuration />
223
+  </component>
224
+  <component name="TaskManager">
225
+    <task active="true" id="Default" summary="Default task">
226
+      <changelist id="7ad04558-d1a8-448f-add7-490f9c754201" name="Default Changelist" comment="" />
227
+      <created>1542149227412</created>
228
+      <option name="number" value="Default" />
229
+      <option name="presentableId" value="Default" />
230
+      <updated>1542149227412</updated>
231
+      <workItem from="1542149228819" duration="2638000" />
232
+    </task>
233
+    <servers />
234
+  </component>
235
+  <component name="TestHistory">
236
+    <history-entry file="MyArrayListTest_sizeAddTest - 2018.11.13 at 18h 21m 51s.xml">
237
+      <configuration name="MyArrayListTest.sizeAddTest" configurationId="JUnit" />
238
+    </history-entry>
239
+    <history-entry file="MyArrayListTest_sizeNoElementsTest - 2018.11.13 at 18h 21m 56s.xml">
240
+      <configuration name="MyArrayListTest.sizeNoElementsTest" configurationId="JUnit" />
241
+    </history-entry>
242
+    <history-entry file="MyArrayListTest_sizeAddTest - 2018.11.13 at 18h 22m 00s.xml">
243
+      <configuration name="MyArrayListTest.sizeAddTest" configurationId="JUnit" />
244
+    </history-entry>
245
+    <history-entry file="MyArrayListTest_sizeAddTest - 2018.11.13 at 18h 23m 18s.xml">
246
+      <configuration name="MyArrayListTest.sizeAddTest" configurationId="JUnit" />
247
+    </history-entry>
248
+  </component>
249
+  <component name="TimeTrackingManager">
250
+    <option name="totallyTimeSpent" value="2638000" />
251
+  </component>
252
+  <component name="ToolWindowManager">
253
+    <frame x="0" y="23" width="1440" height="807" extended-state="0" />
254
+    <editor active="true" />
255
+    <layout>
256
+      <window_info id="Image Layers" />
257
+      <window_info id="Designer" />
258
+      <window_info id="UI Designer" />
259
+      <window_info id="Capture Tool" />
260
+      <window_info id="Favorites" side_tool="true" />
261
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24964234" />
262
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
263
+      <window_info anchor="bottom" id="Messages" />
264
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
265
+      <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
266
+      <window_info anchor="bottom" id="Terminal" />
267
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
268
+      <window_info anchor="bottom" id="Message" order="0" />
269
+      <window_info anchor="bottom" id="Find" order="1" />
270
+      <window_info anchor="bottom" id="Run" order="2" weight="0.32867134" />
271
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
272
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
273
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
274
+      <window_info anchor="bottom" id="TODO" order="6" />
275
+      <window_info anchor="right" id="Palette" />
276
+      <window_info anchor="right" id="Theme Preview" />
277
+      <window_info anchor="right" id="Capture Analysis" />
278
+      <window_info anchor="right" id="Palette&#9;" />
279
+      <window_info anchor="right" id="Database" />
280
+      <window_info anchor="right" id="Maven Projects" />
281
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
282
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
283
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
284
+    </layout>
285
+  </component>
286
+  <component name="TypeScriptGeneratedFilesManager">
287
+    <option name="version" value="1" />
288
+  </component>
289
+  <component name="VcsContentAnnotationSettings">
290
+    <option name="myLimit" value="2678400000" />
291
+  </component>
292
+  <component name="XDebuggerManager">
293
+    <breakpoint-manager>
294
+      <breakpoints>
295
+        <line-breakpoint enabled="true" type="java-method">
296
+          <url>file://$PROJECT_DIR$/src/main/java/MyArrayList.java</url>
297
+          <line>20</line>
298
+          <properties class="MyArrayList" method="add">
299
+            <option name="EMULATED" value="true" />
300
+          </properties>
301
+          <option name="timeStamp" value="1" />
302
+        </line-breakpoint>
303
+      </breakpoints>
304
+    </breakpoint-manager>
305
+  </component>
306
+  <component name="editorHistoryManager">
307
+    <entry file="file://$PROJECT_DIR$/.gitignore">
308
+      <provider selected="true" editor-type-id="text-editor" />
309
+    </entry>
310
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
311
+      <provider selected="true" editor-type-id="text-editor">
312
+        <state relative-caret-position="360">
313
+          <caret line="26" column="13" lean-forward="true" selection-start-line="26" selection-start-column="13" selection-end-line="26" selection-end-column="13" />
314
+          <folding>
315
+            <element signature="e#338#339#0" expanded="true" />
316
+            <element signature="e#372#373#0" expanded="true" />
317
+          </folding>
318
+        </state>
319
+      </provider>
320
+    </entry>
321
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
322
+      <provider selected="true" editor-type-id="text-editor">
323
+        <state relative-caret-position="465">
324
+          <caret line="31" column="44" selection-start-line="31" selection-start-column="44" selection-end-line="31" selection-end-column="44" />
325
+          <folding>
326
+            <element signature="imports" expanded="true" />
327
+            <element signature="e#143#144#0" expanded="true" />
328
+            <element signature="e#182#183#0" expanded="true" />
329
+          </folding>
330
+        </state>
331
+      </provider>
332
+    </entry>
333
+  </component>
334
+  <component name="masterDetails">
335
+    <states>
336
+      <state key="ProjectJDKs.UI">
337
+        <settings>
338
+          <last-edited>1.8</last-edited>
339
+          <splitter-proportions>
340
+            <option name="proportions">
341
+              <list>
342
+                <option value="0.2" />
343
+              </list>
344
+            </option>
345
+          </splitter-proportions>
346
+        </settings>
347
+      </state>
348
+    </states>
349
+  </component>
350
+</project>

+ 16
- 0
generics.iml 查看文件

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
4
+    <output url="file://$MODULE_DIR$/target/classes" />
5
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
+    <content url="file://$MODULE_DIR$">
7
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
9
+      <excludeFolder url="file://$MODULE_DIR$/target" />
10
+    </content>
11
+    <orderEntry type="inheritedJdk" />
12
+    <orderEntry type="sourceFolder" forTests="false" />
13
+    <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
14
+    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
15
+  </component>
16
+</module>

+ 0
- 0
src/main/java/.deleteme 查看文件


+ 31
- 0
src/main/java/MyArrayList.java 查看文件

@@ -0,0 +1,31 @@
1
+import java.util.Arrays;
2
+
3
+public class MyArrayList {
4
+    private static final int INITIAL_SIZE = 0;
5
+    private Object[] list;
6
+    private int size;
7
+
8
+    public MyArrayList() {
9
+        this.list = new Object[INITIAL_SIZE];
10
+        this.size = list.length;
11
+    }
12
+
13
+    public MyArrayList(int size) {
14
+       this.list = new Object[size];
15
+    }
16
+
17
+    public int size() {
18
+        return list.length;
19
+    }
20
+
21
+    public boolean add(Object o) {
22
+        list = Arrays.copyOf(list, list.length + 1);
23
+        for (int i = 0; i < list.length - 1 ; i++) {
24
+            if (i == list.length - 1){
25
+                list[i] = o;
26
+                return true;
27
+            }
28
+        }
29
+        return false;
30
+    }
31
+}

+ 0
- 0
src/test/java/.deleteme 查看文件


+ 34
- 0
src/test/java/MyArrayListTest.java 查看文件

@@ -0,0 +1,34 @@
1
+import org.junit.Assert;
2
+import org.junit.Before;
3
+import org.junit.Test;
4
+
5
+public class MyArrayListTest {
6
+    MyArrayList list;
7
+
8
+    @Before
9
+    public void setUp() {
10
+        list = new MyArrayList();
11
+    }
12
+
13
+    @Test
14
+    public void sizeAddTest() {
15
+        Integer add1 = 5;
16
+        Integer add2 = 6;
17
+        list.add(add1);
18
+        list.add(add2);
19
+
20
+        int expected = 2;
21
+        int actual = list.size();
22
+
23
+        Assert.assertEquals(expected, actual);
24
+
25
+    }
26
+
27
+    @Test
28
+    public void sizeNoElementsTest() {
29
+        int expected = 0;
30
+        int actual = list.size();
31
+
32
+        Assert.assertEquals(expected, actual);
33
+    }
34
+}