Bump version to 24.04.3.4
[LibreOffice.git] / qadevOOo / runner / lib / TestResult.java
blob5a1f4898b7b9e37bafd5c25d5813f77d2f50209a
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package lib;
21 import java.util.HashMap;
23 /**
24 * The class supports interface tests development and Status calculation.
26 public class TestResult {
27 /**
28 * Contains methods having been tested and their results.
30 private HashMap<String, Status> testedMethods = new HashMap<String, Status>();
32 /**
33 * The method makes method tested with the result, i.e. it adds to its
34 * state OK (if result == true) or FAILED (if result == false) status
35 * and makes the state of the method completed. It's equal to
36 * tested(method, Status(result)) call.
38 * @param method refers to the method which was tested
39 * @param result the result of testing the method
41 * @return the result value
43 * @throw java.lang.IllegalArgumentException if the method is not
44 * available in the interface.
46 * @see #tested(String, Status)
48 public boolean tested( String method, boolean result) {
49 System.out.println("Method "+method+" finished with state "+(result?"OK":"FAILED"));
50 return tested( method, Status.passed( result ) );
53 /**
54 * The method makes the method tested with the status, i.e. it adds the
55 * status to its state and makes it completed.
57 * @param method refers to the method which was tested
58 * @param status describes the result of testing the method
59 * @return <tt>true</tt> if status is OK, <tt>false</tt> otherwise.
61 * @throw java.lang.IllegalArgumentException if the method is not
62 * available in the interface.
64 public boolean tested( String method, Status status ) {
65 testedMethods.put(method,status);
66 return true;
69 /**
70 * @return <tt>true</tt> if the method belongs to the interface tested,
71 * <tt>false</tt> otherwise.
73 public boolean hasMethod( String method ) {
74 return testedMethods.containsKey( method );
77 /**
78 * @return status of testing the method, if it is available (was set by
79 * the tested or assert method), <tt>null</tt> otherwise.
81 * @see #tested(String, boolean)
82 * @see #tested(String, Status)
84 public Status getStatusFor( String method ) {
85 return testedMethods.get( method );