|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.junit.Assert
fr.cnes.sirius.validate.validationTool.Validate
public class Validate
The purpose of this class is to automate the logging of deviations in order to see their evolution. This way, the developers can more easily ensure that a class is still valid even if its components or the classes it uses evolve. This is an extension of the continuous integration to validation.
For each useful method of Assert, Validate provides an implementation that will compute and store the deviation, then call the Assert method. At the end of the test (usually in an @AfterClass method), produceLog() has to be called, otherwise the validation results are not written.
This class is intended as a replacement of the org.junit.Assert class for validation purposes. Its use is similar to the Assert methods of JUnit.
Assert
Constructor Summary | |
---|---|
Validate(Class<?> testClassIn)
constructor of the Validate object. |
Method Summary | |
---|---|
void |
assertEquals(double actual,
double nonRegExpected,
double nonRegEps,
double externalRefExpected,
double externalRefEps,
String deviationDescription)
Works as a replacement to the Assert.assertEquals(double, double, double) method. |
void |
assertEqualsArray(double[] actual,
double[] nonRegExpected,
double nonRegEps,
double[] externalRefExpected,
double externalRefEps,
String deviationDescription)
Compute the deviation of each table value and store it to be put in the logs by the produceLogs method. |
void |
assertEqualsArrayWithRelativeTolerance(double[] actual,
double[] nonRegExpected,
double nonRegEps,
double[] externalRefExpected,
double externalRefEps,
String deviationDescription)
Compute the deviation of each table value and store it to be put in the logs by the produceLogs method, but with a relative tolerance. |
void |
assertEqualsWithRelativeTolerance(double actual,
double nonRegExpected,
double nonRegEps,
double externalRefExpected,
double externalRefEps,
String deviationDescription)
Works as a replacement to the Assert.assertEquals(double, double, double) method
for a relative comparison. |
void |
produceLog()
prints the log in the console and in files. |
void |
produceLog(String logDir)
prints the log in the console and in files. |
Methods inherited from class org.junit.Assert |
---|
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Validate(Class<?> testClassIn) throws IOException
testClassIn
- the test class, which name will be stored to be printed in the logs.
IOException
- if an error occurs during the reading of the fileMethod Detail |
---|
public final void assertEquals(double actual, double nonRegExpected, double nonRegEps, double externalRefExpected, double externalRefEps, String deviationDescription)
Assert.assertEquals(double, double, double)
method.
Compute the deviation and store it to be put in the logs by
the produceLogs method. If the test fails, the deviation is still stored,
but " : test failed" is added to the message.
actual
- the value obtained in the testnonRegExpected
- the value expected by the non-regression referencenonRegEps
- the epsilon allowed with regard to the non-regression referenceexternalRefExpected
- the value expected by the external referenceexternalRefEps
- the epsilon allowed with regard to the external referencedeviationDescription
- the description of the deviationAssert.assertEquals(double, double, double)
public final void assertEqualsArray(double[] actual, double[] nonRegExpected, double nonRegEps, double[] externalRefExpected, double externalRefEps, String deviationDescription)
actual
- the array values obtained in the testnonRegExpected
- the array values expected by the non-regression referencenonRegEps
- the epsilon allowed with regard to the non-regression referenceexternalRefExpected
- the array values expected by the external referenceexternalRefEps
- the epsilon allowed with regard to the external referencedeviationDescription
- the description of the deviationAssert.assertEquals(double, double, double)
public final void assertEqualsWithRelativeTolerance(double actual, double nonRegExpected, double nonRegEps, double externalRefExpected, double externalRefEps, String deviationDescription)
Assert.assertEquals(double, double, double)
method
for a relative comparison.
Compute the deviation and store it to be put in the logs by
the produceLogs method. If the test fails,
the deviation is still stored, but " : test failed" is added
to the message.
actual
- the value obtained in the testnonRegExpected
- the value expected by the non-regression referencenonRegEps
- the epsilon allowed with regard to the non-regression referenceexternalRefExpected
- the value expected by the external referenceexternalRefEps
- the epsilon allowed with regard to the external referencedeviationDescription
- the description of the deviationAssert.assertEquals(double, double, double)
public final void produceLog() throws IOException, URISyntaxException
IOException
- if there was an error in the manipulation of the files
URISyntaxException
- if there was an error in the parsing of the URI of the filespublic final void produceLog(String logDir) throws IOException, URISyntaxException
logDir
- name of log file
IOException
- if there was an error in the manipulation of the files
URISyntaxException
- if there was an error in the parsing of the URI of the filespublic final void assertEqualsArrayWithRelativeTolerance(double[] actual, double[] nonRegExpected, double nonRegEps, double[] externalRefExpected, double externalRefEps, String deviationDescription)
actual
- the array values obtained in the testnonRegExpected
- the array values expected by the non-regression referencenonRegEps
- the epsilon allowed with regard to the non-regression referenceexternalRefExpected
- the array values expected by the external referenceexternalRefEps
- the epsilon allowed with regard to the external referencedeviationDescription
- the description of the deviationAssert.assertEquals(double, double, double)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |