Here are the examples of the java api org.hamcrest.Matchers.is() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1125 Examples
19
Source : WalletTest.java
with MIT License
from zold-io
with MIT License
from zold-io
@Test
public void readsWalletId() throws IOException {
final long id = 5124095577148911L;
final Wallet wallet = new Wallet.File(this.wallet(id));
Matcherreplacedert.replacedertThat(wallet.id(), Matchers.is(id));
}
19
Source : LongTrackerTest.java
with Apache License 2.0
from whylabs
with Apache License 2.0
from whylabs
@Test
public void protobuf_Serialization_ShouldWork() {
val original = new LongTracker();
original.update(1L);
original.update(2L);
original.update(3L);
val msg = original.toProtobuf().build();
val roundTrip = LongTracker.fromProtobuf(msg);
replacedertThat(roundTrip, Matchers.is(original));
}
19
Source : DoubleTrackerTest.java
with Apache License 2.0
from whylabs
with Apache License 2.0
from whylabs
@Test
public void protobuf_Serialization_ShouldWork() {
val original = new DoubleTracker();
original.update(1.0);
original.update(2.0);
original.update(3.0);
val msg = original.toProtobuf().build();
val roundTrip = DoubleTracker.fromProtobuf(msg);
replacedertThat(roundTrip, Matchers.is(original));
}
19
Source : TextMessageTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void toStringWithMultibyteString() {
String expected = "\u3042\u3044\u3046\u3048\u304a";
TextMessage actual = new TextMessage(expected);
replacedertThat(actual.getPayload(), Matchers.is(expected));
replacedertThat(actual.toString(), Matchers.containsString(expected));
}
19
Source : TextMessageTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void toStringWithAscii() {
String expected = "foo,bar";
TextMessage actual = new TextMessage(expected);
replacedertThat(actual.getPayload(), Matchers.is(expected));
replacedertThat(actual.toString(), Matchers.containsString(expected));
}
19
Source : MessageBrokerBeanDefinitionParserTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void annotationMethodMessageHandler() {
loadBeanDefinitions("websocket-config-broker-simple.xml");
SimpAnnotationMethodMessageHandler annotationMethodMessageHandler = this.appContext.getBean(SimpAnnotationMethodMessageHandler.clreplaced);
replacedertNotNull(annotationMethodMessageHandler);
MessageConverter messageConverter = annotationMethodMessageHandler.getMessageConverter();
replacedertNotNull(messageConverter);
replacedertTrue(messageConverter instanceof CompositeMessageConverter);
String name = MessageBrokerBeanDefinitionParser.MESSAGE_CONVERTER_BEAN_NAME;
CompositeMessageConverter compositeMessageConverter = this.appContext.getBean(name, CompositeMessageConverter.clreplaced);
replacedertNotNull(compositeMessageConverter);
name = MessageBrokerBeanDefinitionParser.MESSAGING_TEMPLATE_BEAN_NAME;
SimpMessagingTemplate simpMessagingTemplate = this.appContext.getBean(name, SimpMessagingTemplate.clreplaced);
replacedertNotNull(simpMessagingTemplate);
replacedertEquals("/personal/", simpMessagingTemplate.getUserDestinationPrefix());
List<MessageConverter> converters = compositeMessageConverter.getConverters();
replacedertThat(converters.size(), Matchers.is(3));
replacedertThat(converters.get(0), Matchers.instanceOf(StringMessageConverter.clreplaced));
replacedertThat(converters.get(1), Matchers.instanceOf(ByteArrayMessageConverter.clreplaced));
replacedertThat(converters.get(2), Matchers.instanceOf(MappingJackson2MessageConverter.clreplaced));
ContentTypeResolver resolver = ((MappingJackson2MessageConverter) converters.get(2)).getContentTypeResolver();
replacedertEquals(MimeTypeUtils.APPLICATION_JSON, ((DefaultContentTypeResolver) resolver).getDefaultMimeType());
DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(annotationMethodMessageHandler);
Object pathMatcher = handlerAccessor.getPropertyValue("pathMatcher");
String pathSeparator = (String) new DirectFieldAccessor(pathMatcher).getPropertyValue("pathSeparator");
replacedertEquals(".", pathSeparator);
}
19
Source : MessageBrokerConfigurationTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void configureMessageConvertersCustomAndDefault() {
final MessageConverter testConverter = mock(MessageConverter.clreplaced);
AbstractMessageBrokerConfiguration config = new BaseTestMessageBrokerConfig() {
@Override
protected boolean configureMessageConverters(List<MessageConverter> messageConverters) {
messageConverters.add(testConverter);
return true;
}
};
CompositeMessageConverter compositeConverter = config.brokerMessageConverter();
replacedertThat(compositeConverter.getConverters().size(), Matchers.is(4));
Iterator<MessageConverter> iterator = compositeConverter.getConverters().iterator();
replacedertThat(iterator.next(), Matchers.is(testConverter));
replacedertThat(iterator.next(), Matchers.instanceOf(StringMessageConverter.clreplaced));
replacedertThat(iterator.next(), Matchers.instanceOf(ByteArrayMessageConverter.clreplaced));
replacedertThat(iterator.next(), Matchers.instanceOf(MappingJackson2MessageConverter.clreplaced));
}
19
Source : MessageBrokerConfigurationTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void configureMessageConvertersCustom() {
final MessageConverter testConverter = mock(MessageConverter.clreplaced);
AbstractMessageBrokerConfiguration config = new BaseTestMessageBrokerConfig() {
@Override
protected boolean configureMessageConverters(List<MessageConverter> messageConverters) {
messageConverters.add(testConverter);
return false;
}
};
CompositeMessageConverter compositeConverter = config.brokerMessageConverter();
replacedertThat(compositeConverter.getConverters().size(), Matchers.is(1));
Iterator<MessageConverter> iterator = compositeConverter.getConverters().iterator();
replacedertThat(iterator.next(), Matchers.is(testConverter));
}
19
Source : MessageBrokerConfigurationTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void configureMessageConvertersDefault() {
AbstractMessageBrokerConfiguration config = new BaseTestMessageBrokerConfig();
CompositeMessageConverter compositeConverter = config.brokerMessageConverter();
List<MessageConverter> converters = compositeConverter.getConverters();
replacedertThat(converters.size(), Matchers.is(3));
replacedertThat(converters.get(0), Matchers.instanceOf(StringMessageConverter.clreplaced));
replacedertThat(converters.get(1), Matchers.instanceOf(ByteArrayMessageConverter.clreplaced));
replacedertThat(converters.get(2), Matchers.instanceOf(MappingJackson2MessageConverter.clreplaced));
ContentTypeResolver resolver = ((MappingJackson2MessageConverter) converters.get(2)).getContentTypeResolver();
replacedertEquals(MimeTypeUtils.APPLICATION_JSON, ((DefaultContentTypeResolver) resolver).getDefaultMimeType());
}
19
Source : TemplateProcessorTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void testTemplateFile() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("test", "YEP");
Matcherreplacedert.replacedertThat(TemplateProcessor.processTemplateResourceFile("/TestTemplateProcessorTemplateFile.tpl", map), Matchers.is("YEP"));
}
19
Source : TemplateProcessorTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void testTemplateString() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("test", "YEP");
Matcherreplacedert.replacedertThat(TemplateProcessor.processTemplate("${test}", map), Matchers.is("YEP"));
}
19
Source : TemplateBlockBinderTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_getTemplateBlockType() {
Matcherreplacedert.replacedertThat(new TemplateBlockBinder("").getTemplateBlockType(), Matchers.is(TemplateBlockType.BINDER));
}
19
Source : StaticTemplateBlockTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_getTemplateBlockType() {
Matcherreplacedert.replacedertThat(new StaticTemplateBlock("").getTemplateBlockType(), Matchers.is(TemplateBlockType.STATIC));
}
19
Source : PlainTextTemplateBlockTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_getTemplateBlockType() {
Matcherreplacedert.replacedertThat(new PlainTextTemplateBlock("").getTemplateBlockType(), Matchers.is(TemplateBlockType.PLAIN_TEXT));
}
19
Source : IfTemplateBlockTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_getTemplateBlockType() {
Matcherreplacedert.replacedertThat(new IfTemplateBlock("abc", "").getTemplateBlockType(), Matchers.is(TemplateBlockType.IF));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void parseNamedAttributes_parseAttributes() {
String stringToParse = " abc : '/val1' , def : 'v.a.l2',hij:'val 3' ";
Map<String, String> map = ParseUtilities.parseNamedAttributes(stringToParse);
Matcherreplacedert.replacedertThat(map.get("abc"), Matchers.is("/val1"));
Matcherreplacedert.replacedertThat(map.get("def"), Matchers.is("v.a.l2"));
Matcherreplacedert.replacedertThat(map.get("hij"), Matchers.is("val 3"));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void trimContentString_trimContentString_Test() {
Matcherreplacedert.replacedertThat(ParseUtilities.trimContentString(" \nabc"), Matchers.is("abc"));
Matcherreplacedert.replacedertThat(ParseUtilities.trimContentString(" \n abc"), Matchers.is(" abc"));
Matcherreplacedert.replacedertThat(ParseUtilities.trimContentString(" \n \nabc"), Matchers.is(" \nabc"));
Matcherreplacedert.replacedertThat(ParseUtilities.trimContentString("\nabc"), Matchers.is("abc"));
Matcherreplacedert.replacedertThat(ParseUtilities.trimContentString(" \nabc\n "), Matchers.is("abc\n"));
Matcherreplacedert.replacedertThat(ParseUtilities.trimContentString(" \nabc\n"), Matchers.is("abc\n"));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void parseString_templateWithDifferentVariableTextBlocks_Test() throws Exception {
final String TEMPLATE_STRING = ParseUtilities.readResourceToString("/TestTemplateWithDifferentVariableTextBlocks.tpl");
final String EXPECTED_RESULT = ParseUtilities.readResourceToString("/TestTemplateWithDifferentVariableTextBlocks.expectedResult");
Map<String, Object> values = new HashMap<String, Object>();
values.put("test", new TestClreplaced2());
Matcherreplacedert.replacedertThat(ParseUtilities.parseString(TEMPLATE_STRING).getContent(values), Matchers.is(EXPECTED_RESULT));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void parseString_include_withModelAttribute_Test() throws Exception {
final String TEMPLATE_STRING = ParseUtilities.readResourceToString("/IncludeTestWithModelAttribute.tpl");
final String EXPECTED_RESULT = ParseUtilities.readResourceToString("/IncludeTemplateBlockTest.expectedResult");
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> subModel = new HashMap<String, Object>();
Map<String, Object> subSubModel = new HashMap<String, Object>();
subSubModel.put("value", "test");
model.put("model", subModel);
subModel.put("bridge", subSubModel);
Matcherreplacedert.replacedertThat(ParseUtilities.parseString(TEMPLATE_STRING).getContent(model), Matchers.is(EXPECTED_RESULT));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void parseString_ComplexTemplateWithControlBlock() throws Exception {
final String TEMPLATE_STRING = ParseUtilities.readResourceToString("/ComplexTemplateWithControlBlock.tpl");
final String EXPECTED_RESULT = ParseUtilities.readResourceToString("/ComplexTemplateWithControlBlock.expectedResult");
Map<String, Object> values = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<String, Object>();
List<ComplexTemplateWithControlBlockPojo> loopValues = new ArrayList<ComplexTemplateWithControlBlockPojo>();
loopValues.add(new ComplexTemplateWithControlBlockPojo(1));
loopValues.add(new ComplexTemplateWithControlBlockPojo(2));
loopValues.add(new ComplexTemplateWithControlBlockPojo(3));
model.put("loopValues", loopValues);
values.put("model", model);
Matcherreplacedert.replacedertThat(ParseUtilities.parseString(TEMPLATE_STRING).getContent(values), Matchers.is(EXPECTED_RESULT));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void parseString_include_withModelDefinitionInContentBlock_Test() throws Exception {
final String TEMPLATE_STRING = ParseUtilities.readResourceToString("/IncludeTestWithModelDefinitionInContent.tpl");
final String EXPECTED_RESULT = ParseUtilities.readResourceToString("/IncludeTemplateBlockTest.expectedResult");
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> subModel = new HashMap<String, Object>();
Map<String, Object> subSubModel = new HashMap<String, Object>();
subSubModel.put("value", "test");
model.put("model", subModel);
subModel.put("bridge", subSubModel);
Matcherreplacedert.replacedertThat(ParseUtilities.parseString(TEMPLATE_STRING).getContent(model), Matchers.is(EXPECTED_RESULT));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void parseString_templateWithDifferentIfStatements_Test() throws Exception {
final String TEMPLATE_STRING = ParseUtilities.readResourceToString("/TestTemplateWithDifferentIfStatments.tpl");
final String EXPECTED_RESULT = ParseUtilities.readResourceToString("/TestTemplateWithDifferentIfStatements.expectedResult");
Map<String, Object> values = new HashMap<String, Object>();
values.put("xyz", true);
Matcherreplacedert.replacedertThat(ParseUtilities.parseString(TEMPLATE_STRING).getContent(values), Matchers.is(EXPECTED_RESULT));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void parseString_JustVariableFieldsNoControlBlocks() throws Exception {
final String TEMPLATE_STRING = ParseUtilities.readResourceToString("/MultipleVariableTextWithoutControlBocks.tpl");
final String EXPECTED_RESULT = ParseUtilities.readResourceToString("/MultipleVariableTextWithoutControlBlock.expectedResult");
Map<String, Object> values = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<String, Object>();
model.put("nobler", "nobler");
model.put("wished", "wished");
values.put("model", model);
model.put("pojo", new ParseStringTestPojo());
Matcherreplacedert.replacedertThat(ParseUtilities.parseString(TEMPLATE_STRING).getContent(values), Matchers.is(EXPECTED_RESULT));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void parseString_ComplexTemplateWithAllControlBlocks() throws Exception {
final String TEMPLATE_STRING = ParseUtilities.readResourceToString("/ComplexTemplateWithAllBlockTypes.tpl");
final String EXPECTED_RESULT = ParseUtilities.readResourceToString("/ComplexTemplateWithAllBlockTypes.expectedResult");
Map<String, Object> values = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<String, Object>();
List<ComplexTemplateWithControlBlockPojo> loopValues = new ArrayList<ComplexTemplateWithControlBlockPojo>();
loopValues.add(new ComplexTemplateWithControlBlockPojo(1));
loopValues.add(new ComplexTemplateWithControlBlockPojo(2));
loopValues.add(new ComplexTemplateWithControlBlockPojo(3));
model.put("loopValues", loopValues);
values.put("model", model);
values.put("xyz", true);
Matcherreplacedert.replacedertThat(ParseUtilities.parseString(TEMPLATE_STRING).getContent(values), Matchers.is(EXPECTED_RESULT));
}
19
Source : ParseUtilitiesTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void readResourceToStringTest() throws Exception {
final String EXPECTED_RESULT = "ABC" + System.lineSeparator() + "DEF" + System.lineSeparator() + "HIJ";
Matcherreplacedert.replacedertThat(ParseUtilities.readResourceToString("/ReadResourceToStringTest.txt"), Matchers.is(EXPECTED_RESULT));
}
19
Source : ModelPathResolverTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void getGetter_testMethodWithParameter() {
Matcherreplacedert.replacedertThat(ModelPathResolver.getGetter(new GetGetterTestClreplaced(), "methodWithParameter"), Matchers.is("getMethodWithParameter"));
}
19
Source : ModelPathResolverTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void getGetter_testDifferentKindOfGetterPrefixes() {
Matcherreplacedert.replacedertThat(ModelPathResolver.getGetter(new GetGetterTestClreplaced(), "isGetter"), Matchers.is("isIsGetter"));
Matcherreplacedert.replacedertThat(ModelPathResolver.getGetter(new GetGetterTestClreplaced(), "getGetter"), Matchers.is("getGetGetter"));
Matcherreplacedert.replacedertThat(ModelPathResolver.getGetter(new GetGetterTestClreplaced(), "hasGetter"), Matchers.is("hasHasGetter"));
}
19
Source : ModelPathResolverTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void getGetter_testExistingMethodName() {
Matcherreplacedert.replacedertThat(ModelPathResolver.getGetter(new GetGetterTestClreplaced(), "someMethod"), Matchers.is("someMethod"));
}
19
Source : UnaryOperationWrapperOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_unaryOperationType_successfulPath_getValue() {
UnaryOperationWrapperOperand unit = new UnaryOperationWrapperOperand(new BooleanOperand("true"), OperationType.NEGATE);
Matcherreplacedert.replacedertThat((Boolean) unit.value(), Matchers.is(false));
unit = new UnaryOperationWrapperOperand(new BooleanOperand("false"), OperationType.NEGATE);
Matcherreplacedert.replacedertThat((Boolean) unit.value(), Matchers.is(true));
}
19
Source : StringOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
@Ignore
public void testStringWithEscapedEscapeChars() {
Matcherreplacedert.replacedertThat(new StringOperand("'ABC\\\\ DEF'").value(), Matchers.is("ABC\\ DEF"));
Matcherreplacedert.replacedertThat(new StringOperand("'ABC\\\\\\' DEF'").value(), Matchers.is("ABC\\' DEF"));
}
19
Source : StringOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void testStringWithEscapedQuotes() {
Matcherreplacedert.replacedertThat(new StringOperand("'ABC\\' DEF'").value(), Matchers.is("ABC' DEF"));
Matcherreplacedert.replacedertThat(new StringOperand("'//%\\'&§\\'/'").value(), Matchers.is("//%'&§'/"));
}
19
Source : StringOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void testStringWithoutEscapes() {
Matcherreplacedert.replacedertThat(new StringOperand("'ABC DEF'").value(), Matchers.is("ABC DEF"));
Matcherreplacedert.replacedertThat(new StringOperand("'//%&§/'").value(), Matchers.is("//%&§/"));
Matcherreplacedert.replacedertThat(new StringOperand("'A%§GS34234|||F'").value(), Matchers.is("A%§GS34234|||F"));
}
19
Source : OperandTypeTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void testString_pattern_escapeSingleQuoteCorrectlyWithMultipleEscapesAtEnd() {
String testString = "ABC 'DEF\\\\\\\\\\\\\\' GHIJ \\\\\\'KLM' XYZ";
Matcher matcher = OperandType.STRING.getOperandPattern().matcher(testString);
Matcherreplacedert.replacedertThat(matcher.find(), Matchers.is(true));
Matcherreplacedert.replacedertThat(matcher.groupCount(), Matchers.is(1));
Matcherreplacedert.replacedertThat(matcher.group(1), Matchers.is("DEF\\\\\\\\\\\\\\' GHIJ \\\\\\'KLM"));
}
19
Source : OperandTypeTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void testString_pattern_reluctantlessness() {
String testString = "ABC 'DEF' GHIJ 'KLM' XYZ";
Matcher matcher = OperandType.STRING.getOperandPattern().matcher(testString);
Matcherreplacedert.replacedertThat(matcher.find(), Matchers.is(true));
Matcherreplacedert.replacedertThat(matcher.groupCount(), Matchers.is(1));
Matcherreplacedert.replacedertThat(matcher.group(1), Matchers.is("DEF"));
}
19
Source : OperandTypeTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void testString_pattern_escapeSingleQuoteCorrectly() {
String testString = "ABC 'DEF\\' GHIJ \\'KLM' XYZ";
Matcher matcher = OperandType.STRING.getOperandPattern().matcher(testString);
Matcherreplacedert.replacedertThat(matcher.find(), Matchers.is(true));
Matcherreplacedert.replacedertThat(matcher.groupCount(), Matchers.is(1));
Matcherreplacedert.replacedertThat(matcher.group(1), Matchers.is("DEF\\' GHIJ \\'KLM"));
}
19
Source : OperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void OperandType_getOperand_testBoolean_false() {
Matcherreplacedert.replacedertThat(OperandType.getOperandType("false"), Matchers.is(OperandType.BOOLEAN));
}
19
Source : OperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void OperandType_getOperand_testDouble() {
Matcherreplacedert.replacedertThat(OperandType.getOperandType("12.34"), Matchers.is(OperandType.DOUBLE));
}
19
Source : OperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void OperandType_getOperand_testString() {
Matcherreplacedert.replacedertThat(OperandType.getOperandType("'1234'"), Matchers.is(OperandType.STRING));
}
19
Source : OperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void OperandType_getOperand_testBoolean_true() {
Matcherreplacedert.replacedertThat(OperandType.getOperandType("true"), Matchers.is(OperandType.BOOLEAN));
}
19
Source : OperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void OperandType_getOperand_testExpression() {
Matcherreplacedert.replacedertThat(OperandType.getOperandType("abc.def.hij"), Matchers.is(OperandType.DYNAMIC_VALUE));
Matcherreplacedert.replacedertThat(OperandType.getOperandType("abc.def"), Matchers.is(OperandType.DYNAMIC_VALUE));
Matcherreplacedert.replacedertThat(OperandType.getOperandType("abc"), Matchers.is(OperandType.DYNAMIC_VALUE));
}
19
Source : LongOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_createLongOperand() {
Matcherreplacedert.replacedertThat((Long) new LongOperand("6").value(), Matchers.is(6L));
Matcherreplacedert.replacedertThat((Long) new LongOperand("-6").value(), Matchers.is(-6L));
}
19
Source : DynamicOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_complexPaths() {
Map<String, Object> model = new HashMap<String, Object>();
model.put("test", new TestClreplaced2());
// apply model to thread local
ModelPathResolver.modelMapThreadLocal.set(model);
Matcherreplacedert.replacedertThat((TestClreplaced2) new DynamicOperand("test").value(), Matchers.is((Object) model.get("test")));
Matcherreplacedert.replacedertThat(((TestClreplaced1) new DynamicOperand("test.testClreplaced1").value()).getValue(), Matchers.is(5));
Matcherreplacedert.replacedertThat(((TestClreplaced1) new DynamicOperand("test.getTestClreplaced1").value()).getValue(), Matchers.is(5));
Matcherreplacedert.replacedertThat((Integer) new DynamicOperand("test.testClreplaced1.value").value(), Matchers.is(5));
Matcherreplacedert.replacedertThat((Integer) new DynamicOperand("test.getTestClreplaced1.getValue").value(), Matchers.is(5));
}
19
Source : DynamicOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void testResolveModelValue() {
Map<String, Object> model = new HashMap<String, Object>();
model.put("longKey", 5L);
model.put("integerKey", 5);
model.put("doubleKey", 5.0);
model.put("floatKey", 5.0f);
model.put("stringKey", "stringValue");
model.put("booleanKey", true);
model.put("objectKey", this);
// apply model to thread local
ModelPathResolver.modelMapThreadLocal.set(model);
Matcherreplacedert.replacedertThat((Long) new DynamicOperand("longKey").value(), Matchers.is(5L));
Matcherreplacedert.replacedertThat((Integer) new DynamicOperand("integerKey").value(), Matchers.is(5));
Matcherreplacedert.replacedertThat((Double) new DynamicOperand("doubleKey").value(), Matchers.is(5.0));
Matcherreplacedert.replacedertThat((Float) new DynamicOperand("floatKey").value(), Matchers.is(5.0f));
Matcherreplacedert.replacedertThat((String) new DynamicOperand("stringKey").value(), Matchers.is("stringValue"));
Matcherreplacedert.replacedertThat((Boolean) new DynamicOperand("booleanKey").value(), Matchers.is(true));
Matcherreplacedert.replacedertThat((Object) new DynamicOperand("objectKey").value(), Matchers.is((Object) this));
}
19
Source : DoubleOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_createDoubleOperand() {
Matcherreplacedert.replacedertThat((Double) new DoubleOperand("6.0").value(), Matchers.is(6.0));
Matcherreplacedert.replacedertThat((Double) new DoubleOperand("-6.0").value(), Matchers.is(-6.0));
}
19
Source : BooleanOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_nonBooleanValue() {
Matcherreplacedert.replacedertThat((Boolean) new BooleanOperand("XYZ").value(), Matchers.is(false));
}
19
Source : BooleanOperandTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void test_createBooleanOperand() {
Matcherreplacedert.replacedertThat((Boolean) new BooleanOperand("true").value(), Matchers.is(true));
Matcherreplacedert.replacedertThat((Boolean) new BooleanOperand("false").value(), Matchers.is(false));
}
19
Source : ExpressionParserTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void evaluateExpression_withModel_equalOperands() {
Map<String, Object> model = new HashMap<String, Object>();
model.put("value1", 5L);
model.put("value2", 5L);
Expression expression = ExpressionParser.parseExpression("value1 == value2", model);
Matcherreplacedert.replacedertThat((Boolean) expression.evaluateExpression().value(), Matchers.is(true));
}
19
Source : ExpressionParserTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void parseExpression_parseNegation_bracesA_Test() {
Matcherreplacedert.replacedertThat((Boolean) ExpressionParser.parseExpression("'' + (40 * (2+3)) == '200'").evaluateExpression().value(), Matchers.is(true));
Matcherreplacedert.replacedertThat((Boolean) ExpressionParser.parseExpression("!(!false || !true)").evaluateExpression().value(), Matchers.is(false));
Matcherreplacedert.replacedertThat((Boolean) ExpressionParser.parseExpression("!(!false || (!true || true))").evaluateExpression().value(), Matchers.is(false));
Matcherreplacedert.replacedertThat((Long) ExpressionParser.parseExpression("(40 * (2+3))").evaluateExpression().value(), Matchers.is(200L));
Matcherreplacedert.replacedertThat((Boolean) ExpressionParser.parseExpression("40 * (2+3) == 200").evaluateExpression().value(), Matchers.is(true));
Matcherreplacedert.replacedertThat((Boolean) ExpressionParser.parseExpression("40 * (2+3) == 200.0 || false && true").evaluateExpression().value(), Matchers.is(true));
Matcherreplacedert.replacedertThat((String) ExpressionParser.parseExpression("'' + (40 * (2+3))").evaluateExpression().value(), Matchers.is("200"));
Matcherreplacedert.replacedertThat((Boolean) ExpressionParser.parseExpression("'' + (40 * (2+3)) == '200'").evaluateExpression().value(), Matchers.is(true));
Matcherreplacedert.replacedertThat((Boolean) ExpressionParser.parseExpression("'' + (40 * (2+3)) == '200' || false && true").evaluateExpression().value(), Matchers.is(true));
}
19
Source : ExpressionParserTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void evaluateExpression_testInbetweenWhitespaces2() {
Expression expression = ExpressionParser.parseExpression("5 ==5");
Matcherreplacedert.replacedertThat((Boolean) expression.evaluateExpression().value(), Matchers.is(true));
}
19
Source : ExpressionParserTest.java
with MIT License
from toolisticon
with MIT License
from toolisticon
@Test
public void evaluateExpression_withModel_evenMoreComplexMixedExpression() {
Map<String, Object> model = new HashMap<String, Object>();
model.put("value1", 5L);
model.put("value2", 6L);
model.put("value3", null);
Expression expression = ExpressionParser.parseExpression("(value1 == 5) || value3 != null && (value2 == 6.0) ", model);
Matcherreplacedert.replacedertThat((Boolean) expression.evaluateExpression().value(), Matchers.is(true));
}
See More Examples