Java Code Examples for com.oracle.java.testlibrary.Asserts#assertEquals()

The following examples show how to use com.oracle.java.testlibrary.Asserts#assertEquals() . 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: ArrayScenario.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected ArrayScenario(String name, ProfilingType profilingType,
                        TypeHierarchy<? extends TypeHierarchy.I, ? extends TypeHierarchy.I> hierarchy) {
    super(name, profilingType, hierarchy);
    final int x = 20;
    final int y = 10;

    TypeHierarchy.I prof = hierarchy.getM();
    TypeHierarchy.I confl = hierarchy.getN();

    this.array = (TypeHierarchy.I[]) Array.newInstance(hierarchy.getClassM(), y);
    Arrays.fill(array, prof);

    this.matrix = (TypeHierarchy.I[][]) Array.newInstance(hierarchy.getClassM(), x, y);
    for (int i = 0; i < x; i++) {
        this.matrix[i] = this.array;
    }

    Asserts.assertEquals(array.length, matrix[0].length, "Invariant");
}
 
Example 2
Source File: ClassInstanceOf.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    if (orig instanceof TypeHierarchy.A) {
        Asserts.assertEquals(result, orig.m(), "Results are not equal for TypeHierarchy.A");
    } else {
        Asserts.assertEquals(result, TypeHierarchy.TEMP, "Result differs from expected");
    }
}
 
Example 3
Source File: CPUSetsReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static String readFromProcStatus(String setType) {
    String path = PROC_SELF_STATUS_PATH;
    Optional<String> o = Optional.empty();

    System.out.println("readFromProcStatus() entering for: " + setType);

    try (Stream<String> stream = Files.lines(Paths.get(path))) {
        o = stream
            .filter(line -> line.contains(setType))
            .findFirst();
    } catch (IOException e) {
        return null;
    }

    if (!o.isPresent()) {
        return null;    // entry not found
    }

    String[] parts = o.get().replaceAll("\\s","").split(":");

    // Should be 2 parts, before and after ":"
    Asserts.assertEquals(parts.length, 2);

    String result = parts[1];
    System.out.println("readFromProcStatus() returning: " + result);
    return result;
}
 
Example 4
Source File: ClassIdentity.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    if (orig.getClass() == TypeHierarchy.A.class) {
        Asserts.assertEquals(result, orig.m(),
                "Results are not equal for TypeHierarchy.A.class");
    } else {
        Asserts.assertEquals(result, TypeHierarchy.TEMP, "Result differs from expected");
    }
}
 
Example 5
Source File: CheckCast.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    if (result != null || orig != null) {
        Objects.requireNonNull(result);
        Objects.requireNonNull(orig);
        Asserts.assertEquals(result, orig.m(), "Results mismatch");
    }
}
 
Example 6
Source File: ClassInstanceOf.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    if (orig instanceof TypeHierarchy.A) {
        Asserts.assertEquals(result, orig.m(), "Results are not equal for TypeHierarchy.A");
    } else {
        Asserts.assertEquals(result, TypeHierarchy.TEMP, "Result differs from expected");
    }
}
 
Example 7
Source File: ClassIsInstance.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    if (baseClass.isInstance(orig)) {
        Asserts.assertEquals(result, orig.m(), "Results are not equal for base class");
    } else {
        Asserts.assertEquals(result, TypeHierarchy.TEMP, "Result differs from expected");
    }
}
 
Example 8
Source File: ClassInstanceOf.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    if (orig instanceof TypeHierarchy.A) {
        Asserts.assertEquals(result, orig.m(), "Results are not equal for TypeHierarchy.A");
    } else {
        Asserts.assertEquals(result, TypeHierarchy.TEMP, "Result differs from expected");
    }
}
 
Example 9
Source File: ClassInstanceOf.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    if (orig instanceof TypeHierarchy.A) {
        Asserts.assertEquals(result, orig.m(), "Results are not equal for TypeHierarchy.A");
    } else {
        Asserts.assertEquals(result, TypeHierarchy.TEMP, "Result differs from expected");
    }
}
 
Example 10
Source File: CheckCast.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    if (result != null || orig != null) {
        Objects.requireNonNull(result);
        Objects.requireNonNull(orig);
        Asserts.assertEquals(result, orig.m(), "Results mismatch");
    }
}
 
Example 11
Source File: CPUSetsReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static String readFromProcStatus(String setType) {
    String path = PROC_SELF_STATUS_PATH;
    Optional<String> o = Optional.empty();

    System.out.println("readFromProcStatus() entering for: " + setType);

    try (Stream<String> stream = Files.lines(Paths.get(path))) {
        o = stream
            .filter(line -> line.contains(setType))
            .findFirst();
    } catch (IOException e) {
        return null;
    }

    if (!o.isPresent()) {
        return null;    // entry not found
    }

    String[] parts = o.get().replaceAll("\\s","").split(":");

    // Should be 2 parts, before and after ":"
    Asserts.assertEquals(parts.length, 2);

    String result = parts[1];
    System.out.println("readFromProcStatus() returning: " + result);
    return result;
}
 
Example 12
Source File: CheckCast.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    if (result != null || orig != null) {
        Objects.requireNonNull(result);
        Objects.requireNonNull(orig);
        Asserts.assertEquals(result, orig.m(), "Results mismatch");
    }
}
 
Example 13
Source File: ReceiverAtInvokes.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    Asserts.assertEquals(result, orig.m(), "Results mismatch");
}
 
Example 14
Source File: ReceiverAtInvokes.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    Asserts.assertEquals(result, orig.m(), "Results mismatch");
}
 
Example 15
Source File: ReceiverAtInvokes.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    Asserts.assertEquals(result, orig.m(), "Results mismatch");
}
 
Example 16
Source File: ArrayScenario.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void check(TypeHierarchy.I res, TypeHierarchy.I orig) {
    Asserts.assertEquals(res, orig, "Check failed");
}
 
Example 17
Source File: ArrayScenario.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void check(TypeHierarchy.I res, TypeHierarchy.I orig) {
    Asserts.assertEquals(res, orig, "Check failed");
}
 
Example 18
Source File: ArrayScenario.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void check(TypeHierarchy.I res, TypeHierarchy.I orig) {
    Asserts.assertEquals(res, orig, "Check failed");
}
 
Example 19
Source File: ReceiverAtInvokes.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void check(Integer result, T orig) {
    Asserts.assertEquals(result, orig.m(), "Results mismatch");
}
 
Example 20
Source File: CPUSetsReader.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static void assertParse(String cpuSet, String expectedResult) {
    Asserts.assertEquals(listToString(parseCpuSet(cpuSet)), expectedResult);
}