Listing 16 shows a unit test to test this service, which was essential to developing the example application.
清单16给出用于测试这个服务的单元测试,这对于开发示例应用程序是必需的。
Listing 17 shows an example of two related updates occurring as an atomic unit.
清单17显示了两个相关更新作为一个原子单元出现的示例。
To refine your unit test further, you can assert that the validation failed for a specific constraint on a specific field, as shown in Listing 8.
要进一步细化单元测试,您可以断言验证会因为特定字段上的特定约束而失败,如清单8所示。
The example in Listing 5 shows how translations from HTML and RTF documents can be mixed in a translation unit.
清单5中的例子说明html和rtf文档中的翻译如何混合出现在翻译单元中。
For instance, if you want to subdivide each of the two grids in the previous listing into two units where one unit is twice as wide as the other, you write the code shown in listing 10.
举例来说,如果您希望将之前清单中的两个网格继续划分为两个单元,其中一个单元是另一个单元的两倍宽度,可以编写如清单10所示的代码。
For these purposes of intended unit representation, an optional conceptual attribute with a default value of false exists on a unit, as shown in Listing 5.
为了达到有意单元表示的目的,在这个单元上有一个带有错误默认值的非强制性概念性属性,如清单5所示。
In the topology shown in Listing 9, core unit types and unit types from a J2EE domain are used together.
在清单9中显示的拓扑中,来自一个j2ee域的单元类型和单元类型是一起使用的。
The unit can contain artifact(s) where each of the artifact instances is uniquely identified by its name within the scope of a unit, as shown in Listing 22.
在在个单元所包含的工件中,其中每一个都可以在这个单元范围内通过它的名称进行唯一的识别,如清单 22所示。
In addition, you can specify a member requirement on a unit that allows members through the member relationship link, as shown in Listing 20.
此外,您还可以确定一个单元上的成员需求,并且这个单元允许这些成员穿过这个成员关系连接,如清单20所示。
The listing shows a utility class that gets used by the unit test.
这个清单给出单元测试使用的实用程序类。
You can further classify a unit using stereotypes as an additional keyword on the unit, as shown in Listing 6.
您还可以将构造型看作是这个单元的额外关键字对一个单元进一步进行分类,如清单6所示。
Requirement is contained in the unit and is uniquely identified by its name with in the scope of a unit, as shown in Listing 16.
这个单元中的需求是唯一通过它在这个单元范围内的名称来鉴定的,如清单16所示。
Testing the form validation can also be done in the unit test (Listing 19 shows the form validation test code).
表单验证的测试也可以在单元测试中完成(清单19展示了表单验证的测试代码)。
Now write the corresponding unit tests, shown in Listing 18
现在编写相应的单元测试,如清单18 所示
The model allows you to set a configurationUnit attribute on the unit to specify that it is a configuration, as shown in Listing 4.
这个模型允许您将一个configurationUnit属性设置到这个单元上,并具体指定它是一个配置,如清单4 所示。
This refactoring enables the unit test code shown in Listing 1.
该重构启用清单1中所示的单元测试代码。
Listing 1 is an actual translation unit.
清单1是一个实际的翻译单元。
For example, Listing 1 defines a unit test that USES JUnit to verify a stubbed out data class called BeerDaoStub.
例如,清单1定义了一个单元测试,该测试使用JUnit来验证一个叫做BeerDaoStub的存根数据类。
Listing 1 adds some div elements, mostly so you can deal with the image gallery as one unit, and details about the image (which you'll add soon) as the other major element.
清单1添加了一些div元素,主要是为了能够将图片库作为一个单元处理,有关图像的细节(稍候会添加)则作为另一个主要因素。
A MemberLink instance defined in the topology model is uniquely identified by its name within the scope of a unit, as shown in Listing 28.
这个拓扑中定义的MemberLink实例在这个单位范围内只能通过它的名称来识别,如清单28所示。
A HostingLink instance defined in the topology model is uniquely identified by its name with in the scope of a unit, as shown in Listing 26.
定义在这个拓扑中的HostingLink实例在这个单元范围中只能通过它的名称来识别,如清单26所示。
As a result, you see lots of tests for things that are easy to test (equals and toString tend to pop out; see Listing 1), and the real logic of the unit under test is ignored.
结果,您会看到对容易测试(equals和toString往往很突出,参见清单1)的内容进行多次的测试,而被测单元的真正逻辑却被忽略了。
The unit declaration for the MySQL database system looks like the code in Listing 2
MySQL数据库系统的单元定义如代码清单 2 所示
Let's say that the complex_calculation method takes so long that you only want to run it when doing acceptance tests, not during unit test runs. One way to limit it appears in Listing 12.
如果complex_calculation方法运行时间较长,您只想在执行验收测试时运行它,而不想在单元测试期间运行它。
Listing 4. Persistence unit XML entry within web.xml.
清单4. web .xml中的持久性单元xml项。
Listing 15: Simple Wicket unit test using JUnit and WicketTester.
清单15:使用JUnit和WicketTester的简单Wicket单元测试。
Listing 2 is a snippet of an Ant script that demonstrates the junit task to execute a batch of unit tests.
清单2是一个ant脚本片段,介绍了执行一批单元测试的junit任务。
To mock out the Grails validation in a unit test, add the mockForConstraintsTests method, as shown in Listing 6.
要在单元测试中模拟Grails验证,添加mockforconstraintstests方法,如清单6所示。
Once the leak was fixed, I wanted to make sure the problem wasn't reintroduced in later code changes, so I built a unit test to help prevent this. It's a resource usage unit test, shown in Listing 1.
下面是一个例子:在邮件应用程序中发现一个内存泄漏,当该泄漏被处理后,我希望确定在以后的代码改变中不会再发生该问题,于是为此构建了一个单元测试。
Listing 16: Base test class for Wicket unit tests of Warsaw and Global projects.
清单16:warsaw和Global项目的Wicket单元测试基类。
应用推荐