org.junit.internal.ArrayComparisonFailure Java Examples
The following examples show how to use
org.junit.internal.ArrayComparisonFailure.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VectorGeneratorTest.java From ignite with Apache License 2.0 | 6 votes |
/** */ @Test public void duplicateRandomFeatures() { VectorGenerator g1 = VectorGeneratorPrimitives.constant(VectorUtils.of(1., 2., 3., 4.)) .duplicateRandomFeatures(2, 1L); double[] exp = {1., 2., 3., 4., 3., 1.}; Vector v1 = g1.get(); Vector v2 = g1.get(); assertArrayEquals(exp, v1.asArray(), 1e-7); try { assertArrayEquals(v1.asArray(), v2.asArray(), 1e-7); } catch (ArrayComparisonFailure e) { //this is valid situation - duplicator should get different features } }
Example #2
Source File: TestQWriter.java From qJava with Apache License 2.0 | 5 votes |
protected void serializeObject( final Object referenceObject, final QExpressions qe, final String expr ) throws IOException, QException, ArrayComparisonFailure { final ByteArrayOutputStream stream = new ByteArrayOutputStream(); final QWriter writer = new DefaultQWriter(); writer.setStream(stream); writer.setEncoding("ISO-8859-1"); writer.write(referenceObject, QConnection.MessageType.SYNC); final byte[] out = stream.toByteArray(); assertArrayEquals("Serialization failed for q expression: " + expr, qe.getBinaryExpression(expr), copyOfRange(out, 8, out.length)); }
Example #3
Source File: Type1FontUtilTest.java From PdfBox-Android with Apache License 2.0 | 5 votes |
private void tryHexEncoding(long seed) throws ArrayComparisonFailure { byte[] bytes = createRandomByteArray(128, seed); String encodedBytes = Type1FontUtil.hexEncode(bytes); byte[] decodedBytes = Type1FontUtil.hexDecode(encodedBytes); assertArrayEquals("Seed: " + seed, bytes, decodedBytes); }
Example #4
Source File: Type1FontUtilTest.java From PdfBox-Android with Apache License 2.0 | 5 votes |
private void tryEexecEncryption(long seed) throws ArrayComparisonFailure { byte[] bytes = createRandomByteArray(128, seed); byte[] encryptedBytes = Type1FontUtil.eexecEncrypt(bytes); byte[] decryptedBytes = Type1FontUtil.eexecDecrypt(encryptedBytes); assertArrayEquals("Seed: " + seed, bytes, decryptedBytes); }
Example #5
Source File: Type1FontUtilTest.java From PdfBox-Android with Apache License 2.0 | 5 votes |
private void tryCharstringEncryption(long seed) throws ArrayComparisonFailure { byte[] bytes = createRandomByteArray(128, seed); byte[] encryptedBytes = Type1FontUtil.charstringEncrypt(bytes, 4); byte[] decryptedBytes = Type1FontUtil.charstringDecrypt(encryptedBytes, 4); assertArrayEquals("Seed: " + seed, bytes, decryptedBytes); }
Example #6
Source File: MergedAnnotationsTests.java From spring-analysis-note with MIT License | 4 votes |
private void testGetWithExhaustiveWebMapping(AnnotatedElement element) throws ArrayComparisonFailure { MergedAnnotation<?> annotation = MergedAnnotations.from(element, SearchStrategy.EXHAUSTIVE).get(RequestMapping.class); assertThat(annotation.getStringArray("value")).containsExactly("/test"); assertThat(annotation.getStringArray("path")).containsExactly("/test"); }
Example #7
Source File: AnnotatedElementUtilsTests.java From java-technology-stack with MIT License | 4 votes |
private void assertWebMapping(AnnotatedElement element) throws ArrayComparisonFailure { WebMapping webMapping = findMergedAnnotation(element, WebMapping.class); assertNotNull(webMapping); assertArrayEquals("value attribute: ", asArray("/test"), webMapping.value()); assertArrayEquals("path attribute: ", asArray("/test"), webMapping.path()); }
Example #8
Source File: AnnotatedElementUtilsTests.java From spring-analysis-note with MIT License | 4 votes |
private void assertWebMapping(AnnotatedElement element) throws ArrayComparisonFailure { WebMapping webMapping = findMergedAnnotation(element, WebMapping.class); assertNotNull(webMapping); assertArrayEquals("value attribute: ", asArray("/test"), webMapping.value()); assertArrayEquals("path attribute: ", asArray("/test"), webMapping.path()); }
Example #9
Source File: MultiDatastreamTests.java From FROST-Server with GNU Lesser General Public License v3.0 | 4 votes |
private void checkObservedPropertiesFor(MultiDatastream md, ObservedProperty... expectedObservedProps) throws ArrayComparisonFailure, ServiceFailureException { ObservedProperty[] fetchedObservedProps2 = md.observedProperties().query().list().toArray(new ObservedProperty[0]); String message = "Incorrect Observed Properties returned."; Assert.assertArrayEquals(message, expectedObservedProps, fetchedObservedProps2); }
Example #10
Source File: SFASupervisedReproducibleIntervals.java From SFA with GNU General Public License v3.0 | 4 votes |
@Test public void testSFAWordsWindowing() { int symbols = 4; int wordLength = 4; boolean normMean = true; // Load the train/test splits ClassLoader classLoader = SFAWordsTest.class.getClassLoader(); TimeSeries[] train = TimeSeriesLoader.loadDataset(classLoader.getResource("datasets/univariate/BEEF/BEEF_TRAIN").getFile()); // test 120 window sizes for (int w = 4; w < 120; w++) { double[][] bins = null; int[] bestValues = null; ArrayList<SFA.ValueLabel>[] orderLine = null; // test for reproducible splits for (int i = 0; i < 3; i++) { SFASupervised sfa = new SFASupervised(HistogramType.INFORMATION_GAIN); // train SFA representation sfa.fitWindowing(train, w, wordLength, symbols, normMean, false); // bins if (bins != null) { try { Assert.assertArrayEquals(bins, sfa.bins); } catch (ArrayComparisonFailure ex) { System.out.println(Arrays.toString(sfa.bestValues)); System.out.println(Arrays.toString(bestValues)); // output : // for (int a = 0; a < bins.length; a++) { // for (int b = 0; b < bins[a].length; b++) { // if (bins[a][b]!=sfa.bins[a][b]) { // System.out.println(orderLine[a]); // System.out.println(sfa.orderLine[a]); // // ArrayList<Integer> splitPoints = new ArrayList<>(); // sfa.findBestSplit(orderLine[a], 0, orderLine[a].size(), symbols, splitPoints); // System.out.println(Arrays.toString(splitPoints.toArray(new Integer[]{}))); // // // test if the split points are the same // for (int x = 0; x < 10; x++) { // splitPoints = new ArrayList<>(); // sfa.findBestSplit(orderLine[a], 0, orderLine[a].size(), symbols, splitPoints); // // System.out.println("Splitpoints"); // for (int split : splitPoints) { // System.out.println(orderLine[a].get(split + 1).value); // } // } // // break output; // } // } // } System.out.println(w); sfa.printBins(); sfa.bins = bins; sfa.printBins(); throw ex; } } bestValues = sfa.bestValues; bins = sfa.bins; orderLine = sfa.orderLine; } } System.out.println("Test passed"); }
Example #11
Source File: Assert.java From j2cl with Apache License 2.0 | 2 votes |
/** * Asserts that two float arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds float array with expected values. * @param actuals float array with actual values * @param delta the maximum delta between <code>expecteds[i]</code> and * <code>actuals[i]</code> for which both numbers are still * considered equal. */ public static void assertArrayEquals(String message, float[] expecteds, float[] actuals, float delta) throws ArrayComparisonFailure { new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals); }
Example #12
Source File: Assert.java From Java-Thread-Affinity with Apache License 2.0 | 2 votes |
/** * Asserts that two object arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. If * <code>expecteds</code> and <code>actuals</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds Object array or array of arrays (multi-dimensional array) with * expected values. * @param actuals Object array or array of arrays (multi-dimensional array) with * actual values */ private static void internalArrayEquals(String message, Object expecteds, Object actuals) throws ArrayComparisonFailure { new ExactComparisonCriteria().arrayEquals(message, expecteds, actuals); }
Example #13
Source File: Assert.java From j2cl with Apache License 2.0 | 2 votes |
/** * Asserts that two object arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. If * <code>expecteds</code> and <code>actuals</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds Object array or array of arrays (multi-dimensional array) with * expected values. * @param actuals Object array or array of arrays (multi-dimensional array) with * actual values */ private static void internalArrayEquals(String message, Object expecteds, Object actuals) throws ArrayComparisonFailure { new ExactComparisonCriteria().arrayEquals(message, expecteds, actuals); }
Example #14
Source File: Assert.java From Java-Thread-Affinity with Apache License 2.0 | 2 votes |
/** * Asserts that two object arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. If * <code>expecteds</code> and <code>actuals</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds Object array or array of arrays (multi-dimensional array) with * expected values. * @param actuals Object array or array of arrays (multi-dimensional array) with * actual values */ public static void assertArrayEquals(String message, Object[] expecteds, Object[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #15
Source File: Assert.java From Java-Thread-Affinity with Apache License 2.0 | 2 votes |
/** * Asserts that two byte arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds byte array with expected values. * @param actuals byte array with actual values */ public static void assertArrayEquals(String message, byte[] expecteds, byte[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #16
Source File: Assert.java From Java-Thread-Affinity with Apache License 2.0 | 2 votes |
/** * Asserts that two char arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds char array with expected values. * @param actuals char array with actual values */ public static void assertArrayEquals(String message, char[] expecteds, char[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #17
Source File: Assert.java From Java-Thread-Affinity with Apache License 2.0 | 2 votes |
/** * Asserts that two short arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds short array with expected values. * @param actuals short array with actual values */ public static void assertArrayEquals(String message, short[] expecteds, short[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #18
Source File: Assert.java From Java-Thread-Affinity with Apache License 2.0 | 2 votes |
/** * Asserts that two int arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds int array with expected values. * @param actuals int array with actual values */ public static void assertArrayEquals(String message, int[] expecteds, int[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #19
Source File: Assert.java From Java-Thread-Affinity with Apache License 2.0 | 2 votes |
/** * Asserts that two long arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds long array with expected values. * @param actuals long array with actual values */ public static void assertArrayEquals(String message, long[] expecteds, long[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #20
Source File: Assert.java From Java-Thread-Affinity with Apache License 2.0 | 2 votes |
/** * Asserts that two double arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds double array with expected values. * @param actuals double array with actual values */ public static void assertArrayEquals(String message, double[] expecteds, double[] actuals, double delta) throws ArrayComparisonFailure { new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals); }
Example #21
Source File: Assert.java From Java-Thread-Affinity with Apache License 2.0 | 2 votes |
/** * Asserts that two float arrays are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expecteds float array with expected values. * @param actuals float array with actual values */ public static void assertArrayEquals(String message, float[] expecteds, float[] actuals, float delta) throws ArrayComparisonFailure { new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals); }
Example #22
Source File: Assert.java From firebase-android-sdk with Apache License 2.0 | 2 votes |
/** * Asserts that two float arrays are equal. If they are not, an {@link AssertionError} is thrown * with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> okay) * @param expecteds float array with expected values. * @param actuals float array with actual values * @param delta the maximum delta between <code>expecteds[i]</code> and <code>actuals[i]</code> * for which both numbers are still considered equal. */ public static void assertArrayEquals( String message, float[] expecteds, float[] actuals, float delta) throws ArrayComparisonFailure { new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals); }
Example #23
Source File: Assert.java From firebase-android-sdk with Apache License 2.0 | 2 votes |
/** * Asserts that two object arrays are equal. If they are not, an {@link AssertionError} is thrown * with the given message. If <code>expecteds</code> and <code>actuals</code> are <code>null * </code>, they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> okay) * @param expecteds Object array or array of arrays (multi-dimensional array) with expected * values. * @param actuals Object array or array of arrays (multi-dimensional array) with actual values */ public static void assertArrayEquals(String message, Object[] expecteds, Object[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #24
Source File: Assert.java From firebase-android-sdk with Apache License 2.0 | 2 votes |
/** * Asserts that two boolean arrays are equal. If they are not, an {@link AssertionError} is thrown * with the given message. If <code>expecteds</code> and <code>actuals</code> are <code>null * </code>, they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> okay) * @param expecteds boolean array with expected values. * @param actuals boolean array with expected values. */ public static void assertArrayEquals(String message, boolean[] expecteds, boolean[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #25
Source File: Assert.java From firebase-android-sdk with Apache License 2.0 | 2 votes |
/** * Asserts that two byte arrays are equal. If they are not, an {@link AssertionError} is thrown * with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> okay) * @param expecteds byte array with expected values. * @param actuals byte array with actual values */ public static void assertArrayEquals(String message, byte[] expecteds, byte[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #26
Source File: Assert.java From firebase-android-sdk with Apache License 2.0 | 2 votes |
/** * Asserts that two char arrays are equal. If they are not, an {@link AssertionError} is thrown * with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> okay) * @param expecteds char array with expected values. * @param actuals char array with actual values */ public static void assertArrayEquals(String message, char[] expecteds, char[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #27
Source File: Assert.java From firebase-android-sdk with Apache License 2.0 | 2 votes |
/** * Asserts that two short arrays are equal. If they are not, an {@link AssertionError} is thrown * with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> okay) * @param expecteds short array with expected values. * @param actuals short array with actual values */ public static void assertArrayEquals(String message, short[] expecteds, short[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #28
Source File: Assert.java From firebase-android-sdk with Apache License 2.0 | 2 votes |
/** * Asserts that two int arrays are equal. If they are not, an {@link AssertionError} is thrown * with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> okay) * @param expecteds int array with expected values. * @param actuals int array with actual values */ public static void assertArrayEquals(String message, int[] expecteds, int[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #29
Source File: Assert.java From firebase-android-sdk with Apache License 2.0 | 2 votes |
/** * Asserts that two long arrays are equal. If they are not, an {@link AssertionError} is thrown * with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> okay) * @param expecteds long array with expected values. * @param actuals long array with actual values */ public static void assertArrayEquals(String message, long[] expecteds, long[] actuals) throws ArrayComparisonFailure { internalArrayEquals(message, expecteds, actuals); }
Example #30
Source File: Assert.java From firebase-android-sdk with Apache License 2.0 | 2 votes |
/** * Asserts that two double arrays are equal. If they are not, an {@link AssertionError} is thrown * with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> okay) * @param expecteds double array with expected values. * @param actuals double array with actual values * @param delta the maximum delta between <code>expecteds[i]</code> and <code>actuals[i]</code> * for which both numbers are still considered equal. */ public static void assertArrayEquals( String message, double[] expecteds, double[] actuals, double delta) throws ArrayComparisonFailure { new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals); }