1package android.support.test;
2/*
3 * Copyright (C) 2014 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
19import org.junit.Before;
20import org.junit.Test;
21
22/**
23 * A set of JUnit4 tests that allocates substantial memory into a member variable.
24 * <p/>
25 * Intended to ensure test objects references are not retained by runner, and can get garbage
26 * collected.
27 */
28public class JUnit4HogTest {
29
30    @SuppressWarnings("unused")
31    private byte[] mByteBuffer;
32
33    @Before
34    public void setUp() {
35        mByteBuffer = new byte[20 * 1024 * 1024];
36    }
37
38    // have 10 sample tests - means 200MB total mem if mByteBuffer not freed
39
40    @Test
41    public void test1() {
42    }
43
44    @Test
45    public void test2() {
46    }
47
48    @Test
49    public void test3() {
50    }
51
52    @Test
53    public void test4() {
54    }
55
56    @Test
57    public void test5() {
58    }
59
60    @Test
61    public void test6() {
62    }
63
64    @Test
65    public void test7() {
66    }
67
68    @Test
69    public void test8() {
70    }
71
72    @Test
73    public void test9() {
74    }
75}
76