Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/sound/sampled/Lines/ToString.java
41153 views
1
/*
2
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package bug.javax.sound.sampled;
27
28
import javax.sound.sampled.Clip;
29
import javax.sound.sampled.DataLine;
30
import javax.sound.sampled.Line;
31
import javax.sound.sampled.Mixer;
32
import javax.sound.sampled.Port;
33
import javax.sound.sampled.SourceDataLine;
34
import javax.sound.sampled.TargetDataLine;
35
36
/**
37
* @test
38
* @bug 8221436
39
* @run main/othervm bug.javax.sound.sampled.ToString
40
*/
41
public final class ToString {
42
43
public static void main(final String[] args) {
44
45
// Behavior of toString() methods is not specified, the checks in
46
// this test just defends against accidental changes.
47
48
String custom = new Line.Info(ToString.class).toString();
49
if (!custom.contains("bug.javax.sound.sampled")) {
50
throw new RuntimeException("Package is missing: " + custom);
51
}
52
String ints = new Line.Info(int.class).toString();
53
if (ints.contains("javax.sound.sampled")) {
54
throw new RuntimeException("Package is present: " + ints);
55
}
56
String array = new Line.Info(int[].class).toString();
57
if (array.contains("javax.sound.sampled")) {
58
throw new RuntimeException("Package is present: " + array);
59
}
60
61
String line = new Line.Info(Line.class).toString();
62
if (!line.equals("interface Line")) {
63
throw new RuntimeException("Wrong string: " + line);
64
}
65
String target = new Line.Info(TargetDataLine.class).toString();
66
if (!target.equals("interface TargetDataLine")) {
67
throw new RuntimeException("Wrong string: " + target);
68
}
69
String source = new Line.Info(SourceDataLine.class).toString();
70
if (!source.equals("interface SourceDataLine")) {
71
throw new RuntimeException("Wrong string: " + source);
72
}
73
String port = new Line.Info(Port.class).toString();
74
if (!port.equals("interface Port")) {
75
throw new RuntimeException("Wrong string: " + port);
76
}
77
String data = new Line.Info(DataLine.class).toString();
78
if (!data.equals("interface DataLine")) {
79
throw new RuntimeException("Wrong string: " + data);
80
}
81
String mixer = new Line.Info(Mixer.class).toString();
82
if (!mixer.equals("interface Mixer")) {
83
throw new RuntimeException("Wrong string: " + mixer);
84
}
85
String clip = new Line.Info(Clip.class).toString();
86
if (!clip.equals("interface Clip")) {
87
throw new RuntimeException("Wrong string: " + clip);
88
}
89
90
String dataLine = new DataLine.Info(DataLine.class, null, 0).toString();
91
if (!dataLine.contains("interface DataLine")) {
92
throw new RuntimeException("Wrong string: " + dataLine);
93
}
94
}
95
}
96
97