APISonar


org.junit.Assert.assertArrayEquals

> org > junit > Assert > assertArrayEquals
org APIs junit APIs Assert APIs assertArrayEquals APIs

Example 1
protected void eq(Object[] actual, Object[] expected) {
		try {
			Assert.assertArrayEquals(expected, actual);
		} catch (AssertionError e) {
			registerError(e);
			throw e;
		}
	}
Example 2
public void testChunkAsArray() throws Exception {

    String[] preds = chunker.chunk(toks1, tags1);

    Assert.assertArrayEquals(expect1, preds);
  }
Example 3
public void testLemmasAsArray() throws Exception {

    String[] lemmas = lemmatizer.lemmatize(tokens, postags);

    Assert.assertArrayEquals(expect, lemmas);
  }
Example 4
protected void assertArrayEquals(String message, long[] expecteds, long[] actuals) throws ArrayComparisonFailure {
    checkThread();
    try {
      Assert.assertArrayEquals(message, expecteds, actuals);
    } catch (AssertionError e) {
      handleThrowable(e);
    }
  }
Example 5
public static void assertArrayEquals(Object[][] expected, Object[][] actual) {
		Assert.assertEquals(expected.length, actual.length);
		for (int i = 0; i < expected.length; i++) {
			Assert.assertArrayEquals(expected[i], actual[i]);
		}
	}
Example 6
public void toArray()
    {
        Object[] typelessArray = this.newWith(1, 2, 3, 4).toArray();
        Assert.assertArrayEquals(typelessArray, new Object[]{1, 2, 3, 4});
        Integer[] typedArray = this.newWith(1, 2, 3, 4).toArray(new Integer[0]);
        Assert.assertArrayEquals(typedArray, new Integer[]{1, 2, 3, 4});
    }
Example 7
public void cloneTest() {
		Integer[] b = {1, 2, 3};
		Integer[] cloneB = ArrayUtil.clone(b);
		Assert.assertArrayEquals(b, cloneB);

		int[] a = {1, 2, 3};
		int[] clone = ArrayUtil.clone(a);
		Assert.assertArrayEquals(a, clone);
	}
Example 8
public void toIntArrayTest() {
		String[] b = { "1", "2", "3", "4" };
		
		Integer[] integerArray = Convert.toIntArray(b);
		Assert.assertArrayEquals(integerArray, new Integer[]{1,2,3,4});
		
		int[] intArray = Convert.convert(int[].class, b);
		Assert.assertArrayEquals(intArray, new int[]{1,2,3,4});
		
		long[] c = {1,2,3,4,5};
		Integer[] intArray2 = Convert.toIntArray(c);
		Assert.assertArrayEquals(intArray2, new Integer[]{1,2,3,4,5});
	}
Example 9
public static <T> void assertOutputEquals(String message, Queue<T> expected, Queue<T> actual) {
		Assert.assertArrayEquals(message,
				expected.toArray(),
				actual.toArray());

	}
Example 10
public void testPartitionCommand() throws Exception {
    final String test1 = "a b c";

    Assert.assertArrayEquals(new String[]{"a", "b", "c"},
        ProcessJob.partitionCommandLine(test1));

    final String test2 = "a 'b c'";
    Assert.assertArrayEquals(new String[]{"a", "b c"},
        ProcessJob.partitionCommandLine(test2));

    final String test3 = "a e='b c'";
    Assert.assertArrayEquals(new String[]{"a", "e=b c"},
        ProcessJob.partitionCommandLine(test3));
  }
Example 11
public void testEasyUtf8()
    throws Exception
    {
        String input = "abcdefghijklm";
        byte[] bytes = _Private_Utils.utf8(input);
        byte[] direct = input.getBytes("UTF-8");
        Assert.assertArrayEquals(direct, bytes);
    }
Example 12
protected void doTestFromString(String value) throws Throwable {
    // string[]
    scbMap = new HashMap<>();
    scbMap.put("bool", new String[] {value});
    Assert.assertArrayEquals(protobufBytes, rootSerializer.serialize(scbMap));

    // string
    scbMap.put("bool", value);
    Assert.assertArrayEquals(protobufBytes, rootSerializer.serialize(scbMap));
  }
Example 13
public void testReadInts() throws IOException
  {
    ByteArrayInputStream inputstream = new ByteArrayInputStream(intsByte);
    int[] actuals = serializerUtils.readInts(inputstream);
    inputstream.close();
    Assert.assertArrayEquals(ints, actuals);
  }
Example 14
public void stringToPrimitiveArray() {
        final Characters characters = testMapping("primitiveArray", "abc");
        Assert.assertArrayEquals("abc".toCharArray(), characters.primitiveArray);
    }
Example 15
public void getQueryParts_shouldProcessSimpleSpaceAsSeparator() {
		String[] actual = patientSearchCriteria.getQueryParts("Anton Bert Charles");
		String[] expected = { "Anton", "Bert", "Charles" };
		
		Assert.assertArrayEquals(expected, actual);
	}
Example 16
private void checkRootDirsClean(File[] rootDirs) {
		for (File rootDir : rootDirs) {
			File[] files = rootDir.listFiles();
			if (files != null) {
				Assert.assertArrayEquals(new File[0], files);
			}
		}
	}
Example 17
private void verifyListeners(Object c, Class<?> eventClass,
            Object... expectedListeners) throws IllegalArgumentException,
            SecurityException, IllegalAccessException,
            InvocationTargetException, NoSuchMethodException {
        Collection<?> registeredListeners = getListeners(c, eventClass);
        assertEquals("Number of listeners", expectedListeners.length,
                registeredListeners.size());

        Assert.assertArrayEquals(expectedListeners,
                registeredListeners.toArray());

    }
Example 18
public void testByteBufferReadStrings()
  {
    ByteBuffer buffer = ByteBuffer.allocate(stringsByte.length);
    buffer.put(stringsByte);
    buffer.flip();
    String[] actuals = serializerUtils.readStrings(buffer);
    Assert.assertArrayEquals(strings, actuals);
  }
Example 19
public void getRecommendedCiphers() {
        String[] expectedCiphers = { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
                "TLS_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
                "TLS_DHE_RSA_WITH_AES_256_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
                "TLS_RSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_AES_256_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" };
        Assert.assertArrayEquals(expectedCiphers, spySSLUtils.getRecommendedCiphers());
    }
Example 20
public void testSerialization() throws IOException {

    byte[] b = new byte[1024];
    new Random(23).nextBytes(b);

    ByteArraySerializer serializer = new ByteArraySerializer();

    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    serializer.serialize(Arrays.copyOf(b, b.length), bOut) ;

    Assert.assertArrayEquals(b, bOut.toByteArray());
    Assert.assertArrayEquals(b, serializer.create(new ByteArrayInputStream(b)));
  }
Example 21
public void testGetBodyBytes() {
    Assert.assertNull(impl.getBodyBytes());

    byte[] bytes = new byte[] {1, 2, 3};
    Buffer bodyBuffer = Buffer.buffer(bytes);
    impl.setBodyBuffer(bodyBuffer);

    Assert.assertArrayEquals(bytes, impl.getBodyBytes());
  }
Example 22
public void testToArray() {
        List<String> list = redisson.getList("list");
        list.add("1");
        list.add("4");
        list.add("2");
        list.add("5");
        list.add("3");

        Assert.assertArrayEquals(list.toArray(), new Object[] {"1", "4", "2", "5", "3"});

        String[] strs = list.toArray(new String[0]);
        Assert.assertArrayEquals(strs, new String[] {"1", "4", "2", "5", "3"});
    }
Example 23
public void testSplitAcceptTypes() {
    String types = "application/json;charset=utf-8,*/*;q=0.9";
    Assert.assertArrayEquals(new String[] {"application/json", "*/*"}, operationMeta.splitAcceptTypes(types));
  }
Example 24
public void whenFilteringFilesEndingWithJson_thenEqualExpectedFiles() {
        FilenameFilter filter = (dir, name) -> name.endsWith(".json");

        String[] expectedFiles = { "people.json", "students.json" };
        String[] actualFiles = directory.list(filter);

        Assert.assertArrayEquals(expectedFiles, actualFiles);
    }
Example 25
public void givenOneStringArray_whenSplittingInHalfTwoStringArrays_shouldSucceed() {
        int ordersHalved = (customers.length / 2) + (customers.length % 2);

        String[] driverOne = Arrays.copyOf(customers, ordersHalved);
        String[] driverTwo = Arrays.copyOfRange(customers, ordersHalved, customers.length);

        Assert.assertArrayEquals(driverOne, new String[] { "Jay", "Harry", "Ronnie" });
        Assert.assertArrayEquals(driverTwo, new String[] { "Gary", "Ross" });
    }