* Tests {@link TensorValues#descriptor(String)}.
*/
@Test
public void testDescriptor() {
final ParameterValueGroup group = create();
final ParameterDescriptorGroup d = group.getDescriptor();
assertDescriptorEquals("num_row", 3, d.descriptor("num_row"));
assertDescriptorEquals("num_col", 3, d.descriptor("num_col"));
assertDescriptorEquals("elt_0_0", 1.0, d.descriptor("elt_0_0"));
assertDescriptorEquals("elt_2_2", 1.0, d.descriptor("elt_2_2"));
/*
* If we reduce the matrix size, than it shall not be possible
* anymore to get the descriptor in the row that we removed.
*/
group.parameter("num_col").setValue(2);
try {
d.descriptor("elt_2_2");
fail("elt_2_2 should not exist.");
} catch (ParameterNotFoundException e) {
final String message = e.getMessage();
assertTrue(message, message.contains("elt_2_2"));
assertTrue(message, message.contains(GROUP_NAME));