本文整理汇总了Java中org.ehcache.config.units.MemoryUnit.B属性的典型用法代码示例。如果您正苦于以下问题:Java MemoryUnit.B属性的具体用法?Java MemoryUnit.B怎么用?Java MemoryUnit.B使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.ehcache.config.units.MemoryUnit
的用法示例。
在下文中一共展示了MemoryUnit.B属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIllegalMaxObjectSizeArgument
@Test
public void testIllegalMaxObjectSizeArgument() {
try {
new DefaultSizeOfEngineConfiguration(0, MemoryUnit.B, 1l);
fail();
} catch (Exception illegalArgument) {
assertThat(illegalArgument, instanceOf(IllegalArgumentException.class));
assertThat(illegalArgument.getMessage(), equalTo("ObjectGraphSize/ObjectSize can only accept positive values."));
}
}
示例2: testIllegalMaxObjectGraphSizeArgument
@Test
public void testIllegalMaxObjectGraphSizeArgument() {
try {
new DefaultSizeOfEngineConfiguration(1l, MemoryUnit.B, 0);
fail();
} catch (Exception illegalArgument) {
assertThat(illegalArgument, instanceOf(IllegalArgumentException.class));
assertThat(illegalArgument.getMessage(), equalTo("ObjectGraphSize/ObjectSize can only accept positive values."));
}
}
示例3: testValidArguments
@Test
public void testValidArguments() {
DefaultSizeOfEngineConfiguration configuration = new DefaultSizeOfEngineConfiguration(10l, MemoryUnit.B, 10l);
assertThat(configuration.getMaxObjectGraphSize(), equalTo(10l));
assertThat(configuration.getMaxObjectSize(), equalTo(10l));
assertThat(configuration.getUnit(), equalTo(MemoryUnit.B));
}
示例4: testIllegalMaxObjectSizeArgument
@Test
public void testIllegalMaxObjectSizeArgument() {
try {
new DefaultSizeOfEngineProviderConfiguration(0, MemoryUnit.B, 1l);
fail();
} catch (Exception illegalArgument) {
assertThat(illegalArgument, instanceOf(IllegalArgumentException.class));
assertThat(illegalArgument.getMessage(), equalTo("SizeOfEngine cannot take non-positive arguments."));
}
}
示例5: testIllegalMaxObjectGraphSizeArgument
@Test
public void testIllegalMaxObjectGraphSizeArgument() {
try {
new DefaultSizeOfEngineProviderConfiguration(1l, MemoryUnit.B, 0);
fail();
} catch (Exception illegalArgument) {
assertThat(illegalArgument, instanceOf(IllegalArgumentException.class));
assertThat(illegalArgument.getMessage(), equalTo("SizeOfEngine cannot take non-positive arguments."));
}
}
示例6: testValidArguments
@Test
public void testValidArguments() {
DefaultSizeOfEngineProviderConfiguration configuration = new DefaultSizeOfEngineProviderConfiguration(10l, MemoryUnit.B, 10l);
assertThat(configuration.getMaxObjectGraphSize(), equalTo(10l));
assertThat(configuration.getMaxObjectSize(), equalTo(10l));
assertThat(configuration.getUnit(), equalTo(MemoryUnit.B));
}