Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
QZero_0
java-design-patterns
提交
054b1eaa
J
java-design-patterns
项目概览
QZero_0
/
java-design-patterns
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
java-design-patterns
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
054b1eaa
编写于
8月 03, 2020
作者:
A
Anurag Agarwal
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resolves test failures
上级
44a654a2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
15 deletion
+18
-15
model-view-controller/src/main/java/com/iluwatar/model/view/controller/Fatigue.java
...main/java/com/iluwatar/model/view/controller/Fatigue.java
+3
-2
model-view-controller/src/main/java/com/iluwatar/model/view/controller/Health.java
.../main/java/com/iluwatar/model/view/controller/Health.java
+3
-2
model-view-controller/src/main/java/com/iluwatar/model/view/controller/Nourishment.java
.../java/com/iluwatar/model/view/controller/Nourishment.java
+3
-2
model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantModelTest.java
...va/com/iluwatar/model/view/controller/GiantModelTest.java
+9
-9
未找到文件。
model-view-controller/src/main/java/com/iluwatar/model/view/controller/Fatigue.java
浏览文件 @
054b1eaa
...
...
@@ -27,8 +27,9 @@ package com.iluwatar.model.view.controller;
* Fatigue enumeration.
*/
public
enum
Fatigue
{
ALERT
(
"alert"
),
TIRED
(
"tired"
),
SLEEPING
(
"sleeping"
);
ALERT
(
"alert"
),
TIRED
(
"tired"
),
SLEEPING
(
"sleeping"
);
private
final
String
title
;
...
...
model-view-controller/src/main/java/com/iluwatar/model/view/controller/Health.java
浏览文件 @
054b1eaa
...
...
@@ -27,8 +27,9 @@ package com.iluwatar.model.view.controller;
* Health enumeration.
*/
public
enum
Health
{
HEALTHY
(
"healthy"
),
WOUNDED
(
"wounded"
),
DEAD
(
"dead"
);
HEALTHY
(
"healthy"
),
WOUNDED
(
"wounded"
),
DEAD
(
"dead"
);
private
final
String
title
;
...
...
model-view-controller/src/main/java/com/iluwatar/model/view/controller/Nourishment.java
浏览文件 @
054b1eaa
...
...
@@ -27,8 +27,9 @@ package com.iluwatar.model.view.controller;
* Nourishment enumeration.
*/
public
enum
Nourishment
{
SATURATED
(
"saturated"
),
HUNGRY
(
"hungry"
),
STARVING
(
"starving"
);
SATURATED
(
"saturated"
),
HUNGRY
(
"hungry"
),
STARVING
(
"starving"
);
private
final
String
title
;
...
...
model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantModelTest.java
浏览文件 @
054b1eaa
...
...
@@ -39,13 +39,13 @@ public class GiantModelTest {
*/
@Test
public
void
testSetHealth
()
{
final
var
model
=
new
GiantModel
(
Health
.
HEALTHY
,
Fatigue
.
ALERT
,
Nourishment
.
HUNGRY
);
final
var
model
=
new
GiantModel
(
Health
.
HEALTHY
,
Fatigue
.
ALERT
,
Nourishment
.
SATURATED
);
assertEquals
(
Health
.
HEALTHY
,
model
.
getHealth
());
var
messageFormat
=
"The giant looks %s, alert and saturated."
;
for
(
final
var
health
:
Health
.
values
())
{
model
.
setHealth
(
health
);
assertEquals
(
health
,
model
.
getHealth
());
assertEquals
(
"The giant looks "
+
health
.
toString
()
+
", alert and saturated."
,
model
.
toString
());
assertEquals
(
String
.
format
(
messageFormat
,
health
),
model
.
toString
());
}
}
...
...
@@ -54,13 +54,13 @@ public class GiantModelTest {
*/
@Test
public
void
testSetFatigue
()
{
final
var
model
=
new
GiantModel
(
Health
.
WOUNDED
,
Fatigue
.
ALERT
,
Nourishment
.
SATURATED
);
final
var
model
=
new
GiantModel
(
Health
.
HEALTHY
,
Fatigue
.
ALERT
,
Nourishment
.
SATURATED
);
assertEquals
(
Fatigue
.
ALERT
,
model
.
getFatigue
());
var
messageFormat
=
"The giant looks healthy, %s and saturated."
;
for
(
final
var
fatigue
:
Fatigue
.
values
())
{
model
.
setFatigue
(
fatigue
);
assertEquals
(
fatigue
,
model
.
getFatigue
());
assertEquals
(
"The giant looks healthy, "
+
fatigue
.
toString
()
+
" and saturated."
,
model
.
toString
());
assertEquals
(
String
.
format
(
messageFormat
,
fatigue
),
model
.
toString
());
}
}
...
...
@@ -69,13 +69,13 @@ public class GiantModelTest {
*/
@Test
public
void
testSetNourishment
()
{
final
var
model
=
new
GiantModel
(
Health
.
HEALTHY
,
Fatigue
.
TIRED
,
Nourishment
.
SATURATED
);
final
var
model
=
new
GiantModel
(
Health
.
HEALTHY
,
Fatigue
.
ALERT
,
Nourishment
.
SATURATED
);
assertEquals
(
Nourishment
.
SATURATED
,
model
.
getNourishment
());
var
messageFormat
=
"The giant looks healthy, alert and %s."
;
for
(
final
var
nourishment
:
Nourishment
.
values
())
{
model
.
setNourishment
(
nourishment
);
assertEquals
(
nourishment
,
model
.
getNourishment
());
assertEquals
(
"The giant looks healthy, alert and "
+
nourishment
.
toString
()
+
"."
,
model
.
toString
());
assertEquals
(
String
.
format
(
messageFormat
,
nourishment
),
model
.
toString
());
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录