* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.yangtools.yang.stmt;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
assertNotNull(container);
assertTrue(container.isPresenceContainer());
- final Collection<MustDefinition> musts = container.getMustConstraints();
+ final Collection<? extends MustDefinition> musts = container.getMustConstraints();
assertEquals(2, musts.size());
- final Iterator<MustDefinition> mustsIterator = musts.iterator();
+ final Iterator<? extends MustDefinition> mustsIterator = musts.iterator();
MustDefinition mustStmt = mustsIterator.next();
- assertThat(mustStmt.getXpath().getOriginalString(), anyOf(is("ifType != 'ethernet' or (ifType = 'ethernet' and "
+ assertThat(mustStmt.getXpath().toString(), anyOf(is("ifType != 'ethernet' or (ifType = 'ethernet' and "
+ "ifMTU = 1500)"), is("ifType != 'atm' or (ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)")));
assertThat(mustStmt.getErrorMessage(), anyOf(is(Optional.of("An ethernet MTU must be 1500")),
is(Optional.of("An atm MTU must be 64 .. 17966"))));
assertThat(mustStmt.getErrorAppTag(), anyOf(is(Optional.of("An ethernet error")),
is(Optional.of("An atm error"))));
mustStmt = mustsIterator.next();
- assertThat(mustStmt.getXpath().getOriginalString(), anyOf(
+ assertThat(mustStmt.getXpath().toString(), anyOf(
is("ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)"),
is("ifType != 'atm' or (ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)")));
assertThat(mustStmt.getErrorMessage(), anyOf(is(Optional.of("An ethernet MTU must be 1500")),
final ContainerSchemaNode container = (ContainerSchemaNode) testModule.getDataChildByName(
QName.create(testModule.getQNameModule(), "test-container"));
assertNotNull(container);
- assertEquals("conditional-leaf = 'autumn-leaf'", container.getWhenCondition().get().getOriginalString());
+ assertEquals("conditional-leaf = 'autumn-leaf'", container.getWhenCondition().orElseThrow().toString());
}
}