• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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 
17 package com.android.build.config;
18 
19 import org.junit.Assert;
20 import org.junit.Test;
21 
22 import java.util.HashMap;
23 
24 public class PositionTest {
25 
26     @Test
testParseEmpty()27     public void testParseEmpty() {
28         final Position pos = Position.parse("");
29 
30         Assert.assertEquals(null, pos.getFile());
31         Assert.assertEquals(Position.NO_LINE, pos.getLine());
32     }
33 
34     @Test
testParseOnlyFile()35     public void testParseOnlyFile() {
36         final Position pos = Position.parse("asdf");
37 
38         Assert.assertEquals("asdf", pos.getFile());
39         Assert.assertEquals(Position.NO_LINE, pos.getLine());
40     }
41 
42     @Test
testParseBoth()43     public void testParseBoth() {
44         final Position pos = Position.parse("asdf:1");
45 
46         Assert.assertEquals("asdf", pos.getFile());
47         Assert.assertEquals(1, pos.getLine());
48     }
49 
50     @Test
testParseEndsWithColon()51     public void testParseEndsWithColon() {
52         final Position pos = Position.parse("asdf:");
53 
54         Assert.assertEquals("asdf", pos.getFile());
55         Assert.assertEquals(Position.NO_LINE, pos.getLine());
56     }
57 
58     @Test
testParseEndsWithSpace()59     public void testParseEndsWithSpace() {
60         final Position pos = Position.parse("asdf: ");
61 
62         Assert.assertEquals("asdf", pos.getFile());
63         Assert.assertEquals(Position.NO_LINE, pos.getLine());
64     }
65 
66 
67 }
68 
69