<commit_before>package org.hbird.transport.payloadcodec;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

import org.hbird.transport.payloadcodec.codecparameters.CodecParameter;
import org.hbird.transport.payloadcodec.exceptions.UnexpectedParameterTypeException;
import org.hbird.transport.payloadcodec.exceptions.UnknownParameterEncodingException;
import org.hbird.transport.payloadcodec.exceptions.UnsupportedParameterEncodingException;
import org.hbird.transport.spacesystemmodel.SpaceSystemModel;
import org.hbird.transport.spacesystemmodel.exceptions.ParameterNotInGroupException;
import org.hbird.transport.spacesystemmodel.exceptions.UnknownParameterGroupException;
import org.hbird.transport.spacesystemmodel.parameters.Parameter;
import org.hbird.transport.spacesystemmodel.tmtcgroups.ParameterGroup;
import org.junit.Test;

public class SpaceSystemModelCodecDecoratorTest {

	private final SpaceSystemModel ssm = new MockSpaceSystemModel();

	@Test
	public void testDecorateSpaceSystemModel() throws UnsupportedParameterEncodingException, UnknownParameterEncodingException, UnexpectedParameterTypeException, UnknownParameterGroupException, ParameterNotInGroupException {
		SpaceSystemModel codecModel = SpaceSystemModelCodecDecorator.decorateSpaceSystemModel(ssm);
		for(Parameter<Integer> p : codecModel.getIntegerParameters()) {
			if(!(p instanceof CodecParameter<?>)) {
				fail("Parameter " + p.getName() + " was not decorated by the codec decorator");
			}
			CodecParameter<Integer> cp = (CodecParameter<Integer>)p;
			assertNotNull(cp);
		}

		for(ParameterGroup pgs : codecModel.getParameterGroupsCollection()) {
			for(Parameter<Integer> p : pgs.getIntegerParameters()) {
				if(!(p instanceof CodecParameter<?>)) {
					fail("Parameter " + p.getName() + " was not decorated by the codec decorator");
				}
				CodecParameter<Integer> cp = (CodecParameter<Integer>)p;
				assertNotNull(cp);
			}
		}<commit_msg>Refactored SpaceSystemModelCodecDecoratorTest to sync with new design.<commit_after>package org.hbird.transport.payloadcodec;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

import org.hbird.transport.payloadcodec.codecparameters.CodecParameter;
import org.hbird.transport.payloadcodec.exceptions.NoEncodingException;
import org.hbird.transport.payloadcodec.exceptions.UnexpectedParameterTypeException;
import org.hbird.transport.payloadcodec.exceptions.UnknownParameterEncodingException;
import org.hbird.transport.payloadcodec.exceptions.UnsupportedParameterEncodingException;
import org.hbird.transport.spacesystemmodel.SpaceSystemModel;
import org.hbird.transport.spacesystemmodel.exceptions.ParameterNotInGroupException;
import org.hbird.transport.spacesystemmodel.exceptions.UnknownParameterException;
import org.hbird.transport.spacesystemmodel.exceptions.UnknownParameterGroupException;
import org.hbird.transport.spacesystemmodel.parameters.Parameter;
import org.hbird.transport.spacesystemmodel.tmtcgroups.ParameterGroup;
import org.junit.Test;

public class SpaceSystemModelCodecDecoratorTest {

	private final SpaceSystemModel ssm = new MockSpaceSystemModel();
	SpaceSystemModelCodecDecorator decorator = new SpaceSystemModelCodecDecorator();

	@Test
	public void testDecorateSpaceSystemModel() throws UnsupportedParameterEncodingException, UnknownParameterEncodingException, UnexpectedParameterTypeException, UnknownParameterGroupException, ParameterNotInGroupException, NoEncodingException, UnknownParameterException {
		SpaceSystemModel codecModel = decorator.decorateSpaceSystemModel(ssm, ssm.getEncodings());
		for(Parameter<Integer> p : codecModel.getAllIntegerParameters().values()) {
			if(!(p instanceof CodecParameter<?>)) {
				fail("Parameter " + p.getName() + " was not decorated by the codec decorator");
			}
			CodecParameter<Integer> cp = (CodecParameter<Integer>)p;
			assertNotNull(cp);
		}

		for(ParameterGroup pgs : codecModel.getParameterGroupsCollection()) {
			for(Parameter<Integer> p : pgs.getIntegerParameters().values()) {
				if(!(p instanceof CodecParameter<?>)) {
					fail("Parameter " + p.getName() + " was not decorated by the codec decorator");
				}
				CodecParameter<Integer> cp = (CodecParameter<Integer>)p;
				assertNotNull(cp);
			}
		}
{'fraction_non_alphanumeric': 0.0919674039580908, 'fraction_numerical': 0.0, 'mean_word_length': 7.357976653696498, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '686132', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1140, 'n_words': 199}