All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cedarsoftware.ncube.NCubeTest.groovy Maven / Gradle / Ivy

There is a newer version: 5.6.9
Show newest version
package com.cedarsoftware.ncube

import com.cedarsoftware.util.CaseInsensitiveSet
import com.cedarsoftware.util.CompactCILinkedMap
import groovy.transform.CompileStatic

/**
 * Class used to carry the NCube meta-information
 * to the client.
 *
 * @author John DeRegnaucourt ([email protected])
 *         
* Copyright (c) Cedar Software LLC *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *

* http://www.apache.org/licenses/LICENSE-2.0 *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @CompileStatic class NCubeTest { private final String name private final Map coord private final CellInfo[] expected NCubeTest(String name, Map input, CellInfo[] expected) { this.name = name coord = new CompactCILinkedMap<>(input) this.expected = expected } String getName() { return name } Map getCoord() { List inputs = new ArrayList(new CaseInsensitiveSet<>(coord.keySet())) Collections.sort(inputs) Map retCoord = new CompactCILinkedMap<>() for (String key : inputs) { retCoord[key] = coord[key] } return retCoord } Map getCoordWithValues() { Map actuals = new CompactCILinkedMap<>() for (item in coord) { Map.Entry entry = item CellInfo cellInfo = (CellInfo) entry.value actuals.put((String)entry.key, cellInfo.recreate()) } return actuals } CellInfo[] getAssertions() { return this.expected } List createAssertions() { List actuals = [] for (CellInfo item : this.expected) { actuals.add((GroovyExpression) item.recreate()) } return actuals } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy