CompilationResult.java revision 9064a1dd60eb8c2f9d2ed705b36bb5f0b1629771
1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.databinding.compilationTest;
18
19public class CompilationResult {
20    public final int resultCode;
21    public final String output;
22    public final String error;
23
24    public CompilationResult(int resultCode, String output, String error) {
25        this.resultCode = resultCode;
26        this.output = output;
27        this.error = error;
28    }
29
30    public boolean resultContainsText(String text) {
31        return resultCode == 0 && output.indexOf(text) > 0;
32    }
33
34    public boolean errorContainsText(String text) {
35        return resultCode != 0 && error.indexOf(text) > 0;
36    }
37}
38